Recently David Merfield, the developer behind Blot, documented the steps to expose a JSON feed on a Blot site. I have been running a JSON feed for my blog for quite some time now, with some valuable help from David of course. It is this feed that drives the On This Day page on this blog. I thought I will share my approach so that others with a blog running on Blot can create such a page.
tz variables appropriately to reflect the URL for the JSON feed and the timezone for your blog, you can refer to the formats in TZ database time zones. This script does the following.
- Fetches all the posts as JSON objects from the JSON feed
- Identifies the posts that share the same date and month as the current date (but not the year to avoid loading today’s posts)
- Renders the posts (or no posts message) in the predefined section detailed below. This also includes some styling via the
.classNamedefinition, you can remove/modify that as per your liking in fuction
Next, create another view for a page to display these posts; a reference html page is available as a gist. Modify the
div element with
Do give this a try, it is fascinating to see your thoughts change, or at times stay exactly the same, over the year. Reach out to me if you face any issues or find any step missing.