Building an 'on this day' feature for my website
Published on under the IndieWeb category.

"on this day," in the context of the web, refers to a tool that lets you see what you have posted on a particular day over a previous time period, typically over years. I have been thinking about this idea since the IndieWebCamp Berlin event, after seeing David's personal website with a "this week" section. This section shows all of David's posts from a given week in the past.
The concept of being able to see what I have posted in the past intrigues me, serving as a reminder that my website is a growing being. Additionally, a page that shows old posts on a given day raises the profile of some of my older posts that may be further in my archives, particularly those that are not featured on a prominent category (i.e. coffee or the IndieWeb on this site). I could bring a bit more serendipity to my site for both users and myself.
I set out thinking: how could I build an "on this day" feature for my website?
I decided to call my feature the "time machine" since the page I aimed to build would let you peek into the past and see old posts. Mysterious indeed, although the logic not so much. I added two rules to my time machine:
- Retrieve any post published on the current day in previous years.
- Retrieve posts published on the current day in previous months, starting from six months ago.
The first point is common to many "on this day" pages and features. But, for me it did not make as much sense because I only have content going back to 2019 on this website. Some days may display no content on the time machine page. That would make for a pretty boring experience for a time machine. That's why I added the second rule. Retrieving posts from the current day in previous months increases the size of the list of posts and the likelihood that at least one post will appear on a given page. Today's page, for example, shows 37 posts. That means I have posted 37 articles on the 6th of any month starting from six months ago.
Each entry on the time machine page shows the title of the article published and the number of years and months ago it was published. I had to add a few "if" statements so that posts two or more years old would say "years" and posts published with a "one month" in their title would not be the plural "months". I concatenate months and years with an "and" in between if a post was published more than one year ago. I end up with a list of dates like this:
- 8 months ago
- 1 year ago
- 1 year and one month ago
- 9 months ago
These examples are taken from today's on this day.
The full entries look like this:
- 8 months ago: Brainstorming Email to RSS | James' Coffee Blog
- 1 year ago: My search engine has moved to IndieWeb Search | James' Coffee Blog
- 1 year and 1 month ago: Weighing search results on my personal search engine | James' Coffee Blog
- 9 months ago: My Edinburgh Field Report is in Barista Magazine | James' Coffee Blog
I intentionally linked four entries to show that the posts are not ordered by date at the moment. I need to add this ordering. I plan to put the oldest posts at the top to make them more prominent on the page. The list of posts is quite long today -- 37 as aforementioned --and will only grow as I write more posts. I might explore only showing posts from a given week like David's site so that I don't end up with too many posts showing up on the page.
My notes, likes, and other posts are excluded from the list: only my articles show up.
I built this feature as an addition to my site search engine. The "time machine" page uses a SQL LIKE statement to find timestamps that match up to the current day of the month. Then, the time machine calculates how many months and years ago each post was created. Finally, the post entries appear on the page with links to the posts to which they refer.
Try my time machine feature and feel free to let me know what you think. I'm excited by this addition to my website!
Responses
Comment on this post
Respond to this post by sending a Webmention.
Have a comment? Email me at readers@jamesg.blog.