use manual rss feed so I can have multiple later
This commit is contained in:
parent
1a0665d84b
commit
a6a086aa32
3 changed files with 40 additions and 17 deletions
38
content/blog-feed.njk
Normal file
38
content/blog-feed.njk
Normal file
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml-stylesheet href="/pretty-atom-feed.xml" type="text/xsl"?>
|
||||
<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.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
|
||||
<id>{{ metadata.base | addPathPrefixToFullUrl }}</id>
|
||||
<author>
|
||||
<name>{{ metadata.author.name }}</name>
|
||||
</author>
|
||||
{%- for post in collections.posts | reverse %}
|
||||
{%- 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>
|
||||
{%- endfor %}
|
||||
</feed>
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue