-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfeed.njk
34 lines (34 loc) · 1.42 KB
/
feed.njk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
pagination:
data: config.locales
size: 1
alias: locale
permalink: "{% if locale !== defaultLanguage %}/{{ supportedLanguages[locale].slug }}{% endif %}/feed.xml"
eleventyExcludeFromCollections: true
---
{% set collection = "postFeed_" + locale %}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ locale }}">
<title>{{ site[locale].name }}</title>
<subtitle>{% _ locale, "The most recent posts from %s", site[locale].name %}</subtitle>
<link href="{{ config.url }}{% if locale !== defaultLanguage %}/{{ supportedLanguages[locale].slug }}{% endif %}/feed.xml" rel="self"/>
<link href="{{ config.url }}{% if locale !== defaultLanguage %}/{{ supportedLanguages[locale].slug }}{% endif %}"/>
<updated>{{ collections[collection] | rssLastUpdatedDate }}</updated>
<id>{{ config.url }}</id>
<author>
<name>{{ site[locale].authorName }}</name>
<email>{{ site[locale].authorEmail }}</email>
</author>
{% for post in collections[collection] %}
{% set absolutePostUrl %}{{ config.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>