Adding RSS support to this website

This site runs the Digital Garden Obsidian plugin by Ole Eskild Skeensen which can be found on GitHub. Ole also provides a template for the repository the plugin needs to do its magic which can be found here.

RSS is implemented by using the Nunjucks template in src/site/feed.njk. However, there is an escaping bug for all <link> tags. Instead of using 4 backslashes before the closing > you need 5, otherwise the resulting XML will be invalid. So, the correct code looks like this:

{%if meta.siteBaseUrl %}<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ meta.siteBaseUrl }}">
    <title>{{ meta.siteName}}</title>
    <link href="{{ meta.siteBaseUrl }}{{ permalink }}" rel="self" /////>
    <link href="{{ meta.siteBaseUrl }}" /////>
    <updated>{{ collections.notes | getNewestCollectionItemDate | dateToRfc3339 }}</updated>

Running into issues with dates

When the code is run locally, Eleventy creates a feed.xml file which can be parsed by RSS readers. It contains the latest posts by date. Eleventy seems to get the dates either from the filesystem or from the GitHub history.

When deploying the repo on Vercel, however, it seems to make a shallow copy of the repo and doesn't care about dates at all. The resulting feed.xml now also contains all posts, but with the current build date of the site on the Vercel infrastructure. Even worse, the date gets changed for all posts every time there is a single update on the site and Eleventy runs. This breaks the intention of having a RSS feed in the first place.

Adding an 'updated' property to all posts

So, properties to the rescue. The Nunjucks template looks in every post if it has an updated property and uses this as the modified date of the post. After adding updated properties to all posts, they still showed up with the wrong date on the site. What now?

The solution is to activate the Let all frontmatter through option in the Global Note Settings section of the Digital Garden plugin options. Just make sure to check all properties of all files for errors, otherwise the deploy will fail. If everything runs through, though, you now have a running RSS setup for your site. Yay!

Open: Pasted image 20250613170322.png
dg-settings-frontmatter.jpeg