Skip to content

site-guide, RSS

RSS Feed

The RSS feed is generated automatically from the post collection and rss.html template which includes the following Atom XML structure:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<title>{{ title }}</title>
	<subtitle>{{ summary }}</subtitle>
	<link href="{{ site.url }}{{ permalink }}" rel="self"/>
	<link href="{{ site.url }}/"/>
	<updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
	<id>{{ site.url }}/</id>
	<author>
		<name>{{ site.authorName }}</name>
		<email>{{ site.authorEmail }}</email>
	</author>
	{% for post in collections.posts %}
		{% set absolutePostUrl %}{{ post.url | htmlBaseUrl(site.url) }}{% endset %}
		<entry>
			<title>{{ post.data.title }}</title>
			<link href="{{ absolutePostUrl }}"/>
			<updated>{{ post.date | dateToRfc3339 }}</updated>
			<id>{{ absolutePostUrl }}</id>
			<content type="html">{{ post.content | renderTransforms(post.data.page, site.url) }}</content>
		</entry>
	{% endfor %}
</feed>

The template loops through collections.posts and creates an <entry> for each post.
The feed also uses the site information defined in _data/site.json, including:

  • url: used to generate absolute URLs.
  • authorName: used for the feed author.
  • authorEmail: used for the feed author email.

Site URL

Make sure the url property in _data/site.json contains the public URL of the website:

"url": "https://example.com"

This is important because RSS readers need absolute URLs to access the feed and its posts.

Adding new posts

There is no need to manually update the feed when adding a new post.
Once a post is saved, it will automatically appear in the generated /feed.xml.
A link to the RSS feed is also available in the Social Menu below.