feat: RSS Feed

This commit is contained in:
marleyrae 2023-06-08 20:17:58 -07:00
parent 3540eadb64
commit c447f1c1bc
7 changed files with 63 additions and 0 deletions

View file

@ -52,5 +52,8 @@ module.exports = function (eleventyConfig) {
return `${folders[3]}/${folders[4]}/${file[0]}`
})
// RSS
eleventyConfig.addPlugin(require('@11ty/eleventy-plugin-rss'))
return {dir: {input: 'src', output: 'dist'}}
}

View file

@ -67,6 +67,9 @@
<a href="https://wiby.me/" target="_blank">
<img src="/images/links/wiby.gif" alt="Wiby Search">
</a>
<a href="https://melonland.net" target="_blank">
<img src="/images/links/melonland.gif" alt="MelonLand">
</a>
</div>
<ul class="List">

16
package-lock.json generated
View file

@ -16,6 +16,7 @@
},
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-plugin-rss": "^1.2.0",
"@ronilaukkarinen/stylelint-a11y": "^1.2.7",
"@types/alpinejs": "^3.7.1",
"cssnano": "^6.0.1",
@ -119,6 +120,21 @@
"url": "https://opencollective.com/11ty"
}
},
"node_modules/@11ty/eleventy-plugin-rss": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-rss/-/eleventy-plugin-rss-1.2.0.tgz",
"integrity": "sha512-YzFnSH/5pObcFnqZ2sAQ782WmpOZHj1+xB9ydY/0j7BZ2jUNahn53VmwCB/sBRwXA/Fbwwj90q1MLo01Ru0UaQ==",
"dev": true,
"dependencies": {
"debug": "^4.3.4",
"posthtml": "^0.16.6",
"posthtml-urls": "1.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/11ty"
}
},
"node_modules/@11ty/eleventy-plugin-vite": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-vite/-/eleventy-plugin-vite-4.0.0.tgz",

View file

@ -12,6 +12,7 @@
"license": "ISC",
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-plugin-rss": "^1.2.0",
"@ronilaukkarinen/stylelint-a11y": "^1.2.7",
"@types/alpinejs": "^3.7.1",
"cssnano": "^6.0.1",

37
src/feed.njk Normal file
View file

@ -0,0 +1,37 @@
---json
{
"permalink": "feed.xml",
"eleventyExcludeFromCollections": true,
"metadata": {
"title": "punkfairie.net",
"language": "en",
"url": "https://punkfairie.net",
"author": {
"name": "mar",
"email": "punkfairie@protonmail.com"
}
}
}
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ metadata.url }}">
<title>{{ metadata.title }}</title>
<link href="{{ permalink | absoluteUrl(metadata.url) }}" rel="self"/>
<link href="{{ metadata.url }}"/>
<updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ metadata.url }}</id>
<author>
<name>{{ metadata.author.name }}</name>
<email>{{ metadata.author.email }}</email>
</author>
{%- for post in collections.posts | reverse %}
{%- set absolutePostUrl = post.url | absoluteUrl(metadata.url) %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.page.date | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id>
<content xml:lang="{{ metadata.language }}" type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
</entry>
{%- endfor %}
</feed>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -22,6 +22,9 @@ layout: layout.liquid
<a href="https://wiby.me/" target="_blank">
<img src="/images/links/wiby.gif" alt="Wiby Search">
</a>
<a href="https://melonland.net" target="_blank">
<img src="/images/links/melonland.gif" alt="MelonLand">
</a>
</div>
<ul class="List">