ckunte.net by Chetan Kunte  

Feeds

While reading JSON feed spec. last week, I realised I could easily produce a JSON feed. So after some tinkering + validation runs, here we are:

  1. JSON feed for this site: ckunte.net/feed.json
  2. JSON feed template in Jinja

Ideally only one feed channel should be sufficient, which is why I didn’t previously consider creating another. Atom feed is the other that’s available on this site:

  1. Atom feed for this site: ckunte.net/rss.xml
  2. Atom feed template in Jinja

Since my notes are often code and math, both of which render poorly in feeds, only note description is available in these site feeds.


Colonoscopy: To remove the trailing comma at EOF in JSON feed, I used this in the template:

{% if not loop.last %},{% endif %}

During validation tests, while JSON validator itself passed it fine, I kept getting an interesting error with the JSON feed validator:

The property '#/items/0/date_published' must be a valid RFC3339 date/time string

After inspecting the date_published string, I realised what was happening. The value from date = time.strptime() (using %m for month, and %H:%M for time) on assignment to year, month, day, hour, minute = date[:5] was truncating the 0 padding from date and time elements, which makes sense, but not for the validator enforcing RFC3339, which requires two-digits to represent parts of date and time. Replacing 'month' = month, with 'month': '{:02d}'.format(month), in my static site generator code (ditto for hour and minute elements) fixed the validation error.