]> Witch of Git - web/blog/blob - feed.njk
Add a Justfile because I didn't remember how to do this last time
[web/blog] / feed.njk
1 ---
2 permalink: feed.xml
3 # The excludeFromCollections seems to be necessary here to avoid "tried to use templateContent too early" but I don't know why
4 # This doesn't seem like it should be necessary, but I get issues with `serve` when I don't have it
5 # From https://github.com/11ty/eleventy/issues/3136
6 eleventyExcludeFromCollections:
7 collections: ["posts"]
8 eleventyImport:
9 collections: ["posts"]
10 metadata:
11 title: Witch of Light
12 url: https://blog.witchoflight.com/
13 author:
14 name: Cassie Jones
15 email: cassie+blog@witchoflight.com
16 feed:
17 subtitle: A collection of Cassie's harebrained schemes.
18 filename: feed.xml
19 path: feed/feed.xml
20 url: https://blog.witchoflight.com/feed.xml
21 id: https://blog.witchoflight.com
22 ---
23 <?xml version="1.0" encoding="utf-8"?>
24 <feed xmlns="http://www.w3.org/2005/Atom">
25 <title>{{ metadata.title }}</title>
26 <subtitle>{{ metadata.feed.subtitle }}</subtitle>
27 <link href="{{ metadata.feed.url }}" rel="self"/>
28 <link href="{{ metadata.url }}"/>
29 <updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
30 <id>{{ metadata.feed.id }}</id>
31 <author>
32 <name>{{ metadata.author.name }}</name>
33 <email>{{ metadata.author.email }}</email>
34 </author>
35 {%- for post in collections.posts %}
36 {% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
37 <entry>
38 <title>{{ post.data.title }}</title>
39 <link href="{{ absolutePostUrl }}"/>
40 <updated>{{ post.date | rssDate }}</updated>
41 <id>{{ absolutePostUrl }}</id>
42 <content type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
43 </entry>
44 {%- endfor %}
45 </feed>