diff options
-rw-r--r-- | eleventy.config.js | 20 | ||||
-rw-r--r-- | feed.njk | 39 |
2 files changed, 41 insertions, 18 deletions
diff --git a/eleventy.config.js b/eleventy.config.js index 0b839ca..f187c91 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,5 +1,5 @@ import { InputPathToUrlTransformPlugin } from "@11ty/eleventy"; -import { feedPlugin } from "@11ty/eleventy-plugin-rss"; +import pluginRss from "@11ty/eleventy-plugin-rss"; import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; import anchor from "markdown-it-anchor"; @@ -62,23 +62,7 @@ export default function (eleventyConfig) { Prism.languages.text = {}; }, }); - eleventyConfig.addPlugin(feedPlugin, { - type: "atom", - outputPath: "/feed.xml", - collection: { - name: "post", - limit: 0, - }, - metadata: { - language: "en", - title: "boringcactus", - subtitle: "boringcactus’s blog posts", - base: "https://www.boringcactus.com/", - author: { - name: "boringcactus / Melody Horn", - }, - }, - }); + eleventyConfig.addPlugin(pluginRss); eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(anchor)); diff --git a/feed.njk b/feed.njk new file mode 100644 index 0000000..28bec07 --- /dev/null +++ b/feed.njk @@ -0,0 +1,39 @@ +---json +{ + "permalink": "feed.xml", + "eleventyExcludeFromCollections": true, + "metadata": { + "language": "en", + "title": "boringcactus", + "subtitle": "boringcactus’s blog posts", + "base": "https://www.boringcactus.com/", + "author": { + "name": "boringcactus / Melody Horn" + } + } +} +--- +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ metadata.language or page.lang }}"> + <title>{{ metadata.title }}</title> + <subtitle>{{ metadata.description }}</subtitle> + <link href="{{ permalink | htmlBaseUrl(metadata.base) }}" rel="self" /> + <link href="{{ metadata.base | addPathPrefixToFullUrl }}" /> + <updated>{{ collections.post | getNewestCollectionItemDate | dateToRfc3339 }}</updated> + <id>{{ metadata.base | addPathPrefixToFullUrl }}</id> + <author> + <name>{{ metadata.author.name }}</name> + </author> + {%- for post in collections.post | reverse %} + {%- if not post.data.unlisted %} + {%- set absolutePostUrl %}{{ post.url | htmlBaseUrl(metadata.base) }}{% 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, metadata.base) }}</content> + </entry> + {%- endif %} + {%- endfor %} +</feed> |