styled rss feed
This commit is contained in:
parent
b593eb1968
commit
1a0665d84b
6 changed files with 107 additions and 33 deletions
0
content/blog-feed/.virtual
Normal file
0
content/blog-feed/.virtual
Normal file
|
@ -1 +0,0 @@
|
||||||
export const eleventyExcludeFromCollections = true;
|
|
|
@ -1,27 +0,0 @@
|
||||||
---
|
|
||||||
# Metadata comes from _data/metadata.js
|
|
||||||
permalink: /blog/feed.xml
|
|
||||||
---
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ metadata.language }}">
|
|
||||||
<title>{{ metadata.title }}</title>
|
|
||||||
<subtitle>{{ metadata.description }}</subtitle>
|
|
||||||
<link href="{{ permalink | htmlBaseUrl(metadata.url) }}" rel="self"/>
|
|
||||||
<link href="{{ metadata.url | htmlBaseUrl }}"/>
|
|
||||||
<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 | htmlBaseUrl(metadata.url) }}{% endset %}
|
|
||||||
<entry>
|
|
||||||
<title>{{ post.data.title }}</title>
|
|
||||||
<link href="{{ absolutePostUrl }}"/>
|
|
||||||
<updated>{{ post.date | dateToRfc3339 }}</updated>
|
|
||||||
<id>{{ absolutePostUrl }}</id>
|
|
||||||
<content type="html">{{ post.templateContent | transformWithHtmlBase(absolutePostUrl, post.url) }}</content>
|
|
||||||
</entry>
|
|
||||||
{%- endfor %}
|
|
||||||
</feed>
|
|
|
@ -1,12 +1,10 @@
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
|
import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
|
||||||
import { EleventyHtmlBasePlugin } from "@11ty/eleventy";
|
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 */
|
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
|
||||||
export default function(eleventyConfig) {
|
export default function(eleventyConfig) {
|
||||||
console.log(process.env);
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'localhost') {
|
if (process.env.NODE_ENV === 'localhost') {
|
||||||
console.log('metadata override');
|
console.log('metadata override');
|
||||||
eleventyConfig.addGlobalData('metadata.url', 'http://localhost:8080');
|
eleventyConfig.addGlobalData('metadata.url', 'http://localhost:8080');
|
||||||
|
@ -37,7 +35,22 @@ export default function(eleventyConfig) {
|
||||||
preAttributes: { tabindex: 0 }
|
preAttributes: { tabindex: 0 }
|
||||||
});
|
});
|
||||||
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
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
|
// Filters
|
||||||
eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => {
|
eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => {
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"homepage": "https://github.com/11ty/eleventy-base-blog#readme",
|
"homepage": "https://github.com/11ty/eleventy-base-blog#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^3.0.0",
|
"@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",
|
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"luxon": "^3.3.0",
|
"luxon": "^3.3.0",
|
||||||
|
|
89
public/pretty-atom-feed.xml
Normal file
89
public/pretty-atom-feed.xml
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue