From a6a086aa320f8c8e39442738431c8055310fdcda Mon Sep 17 00:00:00 2001 From: Nicholas Lamicela Date: Fri, 13 Dec 2024 19:56:48 -0800 Subject: [PATCH] use manual rss feed so I can have multiple later --- content/blog-feed.njk | 38 ++++++++++++++++++++++++++++++++++++++ content/blog-feed/.virtual | 0 eleventy.config.js | 19 ++----------------- 3 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 content/blog-feed.njk delete mode 100644 content/blog-feed/.virtual diff --git a/content/blog-feed.njk b/content/blog-feed.njk new file mode 100644 index 0000000..2017efa --- /dev/null +++ b/content/blog-feed.njk @@ -0,0 +1,38 @@ +---json +{ + "permalink": "/blog/feed.xml", + "eleventyExcludeFromCollections": true, + "metadata": { + "title": "My Blog about Boats", + "description": "I am writing about my experiences as a naval navel-gazer.", + "language": "en", + "base": "https://example.com/", + "author": { + "name": "Boaty McBoatFace" + } + } +} +--- + + + + {{ metadata.title }} + {{ metadata.description }} + + + {{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }} + {{ metadata.base | addPathPrefixToFullUrl }} + + {{ metadata.author.name }} + + {%- for post in collections.posts | reverse %} + {%- set absolutePostUrl %}{{ post.url | htmlBaseUrl(metadata.base) }}{% endset %} + + {{ post.data.title }} + + {{ post.date | dateToRfc3339 }} + {{ absolutePostUrl }} + {{ post.content | renderTransforms(post.data.page, metadata.base) }} + + {%- endfor %} + diff --git a/content/blog-feed/.virtual b/content/blog-feed/.virtual deleted file mode 100644 index e69de29..0000000 diff --git a/eleventy.config.js b/eleventy.config.js index b7b92de..51eac90 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,7 +1,7 @@ import { DateTime } from "luxon"; import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; import { EleventyHtmlBasePlugin } from "@11ty/eleventy"; -import { feedPlugin } from '@11ty/eleventy-plugin-rss'; +import pluginRss from '@11ty/eleventy-plugin-rss'; /** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */ export default function(eleventyConfig) { @@ -35,22 +35,7 @@ export default function(eleventyConfig) { preAttributes: { tabindex: 0 } }); eleventyConfig.addPlugin(EleventyHtmlBasePlugin); - - // RSS Feed - eleventyConfig.addPlugin(feedPlugin, { - type: 'atom', - outputPath: '/blog/feed.xml', - stylesheet: '/pretty-atom-feed.xml', - collection: { name: 'posts' }, - metadata: { - language: 'en', - title: 'nycki.net', - base: 'https://nycki.net/', - author: { - name: 'nycki.net', - }, - }, - }); + eleventyConfig.addPlugin(pluginRss); // Filters eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => {