Add RSS template file

This commit is contained in:
TheThomaas 2023-11-13 21:08:06 +01:00
parent 0dc3e054d6
commit 7006a93819

28
src/rss.njk Normal file
View file

@ -0,0 +1,28 @@
---
permalink: '/feed.xml'
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{% if title %}{{ title }}{% else %}{{ meta.siteName }}{% endif %}</title>
<subtitle>{% if summary %}{{ summary }}{% else %}{{ meta.siteDescription}}{% endif %}</subtitle>
<link href="{{ meta.url }}{{ permalink }}" rel="self"/>
<link href="{{ meta.url }}/"/>
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
<id>{{ meta.url }}</id>
<author>
<name>{{ meta.author }}</name>
<email>{{ meta.authorEmail }}</email>
</author>
{% for post in collections.posts %}
{% set absolutePostUrl %}{{ meta.url }}{{ post.url | url }}{% endset %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | rssDate }}</updated>
<id>{{ absolutePostUrl }}</id>
<content type="html"><![CDATA[
{{ post.templateContent | safe }}
]]></content>
</entry>
{% endfor %}
</feed>