Setting a timestamp for posts and RSS feeds in eleventy

29th December 2021

Why do this?

Most of the time my blog posts only use a date, but I noticed in my RSS feed reader that posts with just a date defaulted to showing 00:00 as the time.

My RSS feed code uses something like the following:

    {% raw %}<updated>{{ | dateToRfc3339 }}</updated>{% endraw %}

…which parses the date and adds a default of midnight.


Change your post date from just a date:

date: 2021-12-29

to a YAML compatible timestamp like:

date: 2021-12-29 17:26:00

ensuring you add the seconds on the end, and the timestamp will show up in your RSS feed reader as 17:26.