diff --git a/content/blog-feed/.virtual b/content/blog-feed/.virtual new file mode 100644 index 0000000..e69de29 diff --git a/content/blog-feed/feed.11tydata.js b/content/blog-feed/feed.11tydata.js deleted file mode 100644 index b2f94c1..0000000 --- a/content/blog-feed/feed.11tydata.js +++ /dev/null @@ -1 +0,0 @@ -export const eleventyExcludeFromCollections = true; diff --git a/content/blog-feed/feed.njk b/content/blog-feed/feed.njk deleted file mode 100644 index 3b2099b..0000000 --- a/content/blog-feed/feed.njk +++ /dev/null @@ -1,27 +0,0 @@ ---- -# Metadata comes from _data/metadata.js -permalink: /blog/feed.xml ---- - - - {{ metadata.title }} - {{ metadata.description }} - - - {{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }} - {{ metadata.url }} - - {{ metadata.author.name }} - {{ metadata.author.email }} - - {%- for post in collections.posts | reverse %} - {% set absolutePostUrl %}{{ post.url | htmlBaseUrl(metadata.url) }}{% endset %} - - {{ post.data.title }} - - {{ post.date | dateToRfc3339 }} - {{ absolutePostUrl }} - {{ post.templateContent | transformWithHtmlBase(absolutePostUrl, post.url) }} - - {%- endfor %} - diff --git a/eleventy.config.js b/eleventy.config.js index 99da04c..b7b92de 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,12 +1,10 @@ import { DateTime } from "luxon"; import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; import { EleventyHtmlBasePlugin } from "@11ty/eleventy"; -import pluginRss from '@11ty/eleventy-plugin-rss'; +import { feedPlugin } from '@11ty/eleventy-plugin-rss'; /** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */ export default function(eleventyConfig) { - console.log(process.env); - if (process.env.NODE_ENV === 'localhost') { console.log('metadata override'); eleventyConfig.addGlobalData('metadata.url', 'http://localhost:8080'); @@ -37,7 +35,22 @@ export default function(eleventyConfig) { preAttributes: { tabindex: 0 } }); eleventyConfig.addPlugin(EleventyHtmlBasePlugin); - eleventyConfig.addPlugin(pluginRss); + + // 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', + }, + }, + }); // Filters eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => { diff --git a/package.json b/package.json index 8ce30b4..dc4106d 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "homepage": "https://github.com/11ty/eleventy-base-blog#readme", "devDependencies": { "@11ty/eleventy": "^3.0.0", - "@11ty/eleventy-plugin-rss": "^1.2.0", + "@11ty/eleventy-plugin-rss": "^2.0.2", "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0", "cross-env": "^7.0.3", "luxon": "^3.3.0", diff --git a/public/pretty-atom-feed.xml b/public/pretty-atom-feed.xml new file mode 100644 index 0000000..6a1c4de --- /dev/null +++ b/public/pretty-atom-feed.xml @@ -0,0 +1,89 @@ + + + + + + + + <xsl:value-of select="atom:feed/atom:title"/> + + + + + + +
+
+

+ + + + + + + + + + + + + + + + + + + Web Feed Preview +

+

+

+

This preview only shows titles, but the actual feed contains the full content.

+ + + + + Visit Website → + +
+

Recent Items

+ +
+ + +
+ +
+

+ + + + + + +

+ + Published: + +
+
+