# I've now got a provisional "On this day" feature at the bottom of the /Today page - just click the link to toggle them. I'm a bit happier with how it looks (I've tried to blend it in at the end of the posts) but may still tweak it. I'll write it up properly in the morning.
On this day...
In an episode of Clevercast Jonathan LaCour discusses freeing himself from Facebook by moving all his content from the network, as well as Instagram, to his own website. No small undertaking.
He mentions missing some features from Facebook such as the way it surfaces memories - inserting posts from the past into your feed. So, as part of the process he created an "On this day" page which lists all of his content, regardless of type or source, for the current day over the years.
It inspired me to do something similar but adding it to /Today rather than as a separate page. I looked to see if there was already a WordPress plugin to add this but, surprisingly, couldn't find one. So I set about writing my own solution.
How does it work?
To start I get the year of the first post to use as a base and assign this to a variable $count
for use later. This is achieved with a post query then looking at the post_date
of the oldest post. I could have just manually set this as 2008 but wanted to do it properly in case I reuse the code.
Then, for each year between then and last year (inclusive) run a custom query to get posts for the day of the year. The query is contained within a while loop while ($count < $today["year"])
and $count
is incremented to stop at the right point.
The first time a post is found it displays the "On this day..." toggle but if no posts are found for the day in any year then nothing will be shown at all.
The toggle itself is a simple CSS trick using a hidden checkbox which, when checked by tapping on its label, shows the post links by use of the :checked
pseudo-class:
#otdCheckbox:checked ~ .otdbody {
display:block;
}
At the end, if $count == $today["year"]
I close out the divs and it's ready. Just 37 lines of code (including whitespace) and a little CSS.
Comments
# It's annoying when you know what you want to say but get stuck on how to say it. That's currently where I am with a post that's about 75% done but just needs that last bit (although "that last bit" is two thirds of the way through.)
@colinwalker I love this feature on Facebook. I‘m also working on this for my personal journal. One step further to get off of FB for me. It‘s great to see what was on my mind a couple of years ago during the same time.
@hutaffe I’ve seen it done before but never really considered it until listening to @cleverdevil. I’m glad I did.
@colinwalker @hutaffe it’s one of my favorite features of my website. I also have my website push the “On this Day” memories to my IndieWeb Reader so I don’t have to remember to visit the page.
@cleverdevil @hutaffe I’m thinking about creating an xml file on the fly now ?
@cleverdevil Do you have any idea if I can delete all FB posts older than a week with one click / app / easy script / plug-in? So that I can use FB as a notification board without leaving too much content there. @hutaffe @colinwalker
@kulturnation I haven’t seen anything out there like that. However, I’d say that gives you a false sense of privacy. I would wager that nothing you “delete” from Facebook is ever truly deleted. This is why I am completely off now.
@cleverdevil Delete is not for privacy reasons but just for taking away content from my timeline so that it becomes less interesting for other people. I can not delete it completely because FB is part of my job; I usually do not post original content there, just links to my blog posts, or sharing.
@kulturnation got it. I bet there is a plugin out there somewhere!
@kulturnation @cleverdevil all the plugins that „work“ and I know of are in Chrome and basically just stupid robots which need luck to complete. I used the „On this day“ feature over the last year to turn every post to private. Deleting does not help with FB...
Inspired by Jonathan LaCour once again I decided to make an RSS feed for the "On this day" section that I can subscribe to and not have to visit the site. As I have previously done with the /Directory and /Blogroll, the xml file is built on the fly as part of the custom loop when visiting the /Today page. All well and good but the idea is not to have to visit the site so I've added the following cron job to quietly load the page for me at 5 minutes past midnight every day:
5 0 * /usr/bin/wget --quiet --output-document=/dev/null https://colinwalker.blog
This ensures the feed is always up to date even without traffic and I'll find the new items waiting for me in my feed reader.? On this day