Add RSS plug-in and blog feed
This commit is contained in:
+6
-1
@@ -1,10 +1,15 @@
|
||||
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
||||
|
||||
const pluginImages = require("./eleventy.config.images.js");
|
||||
|
||||
module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPassthroughCopy("./src/assets/");
|
||||
eleventyConfig.addWatchTarget("./src/assets/");
|
||||
|
||||
// Add plug-ins
|
||||
// Installed Plug-ins
|
||||
eleventyConfig.addPlugin(pluginRss);
|
||||
|
||||
// App plug-ins
|
||||
eleventyConfig.addPlugin(pluginImages);
|
||||
|
||||
// Add short codes
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@11ty/eleventy": "^2.0.1",
|
||||
"@11ty/eleventy-img": "^4.0.2"
|
||||
"@11ty/eleventy-img": "^4.0.2",
|
||||
"@11ty/eleventy-plugin-rss": "^1.2.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
---json
|
||||
{
|
||||
"permalink": "blog/feed.xml",
|
||||
"eleventyExcludeFromCollections": true,
|
||||
"metadata": {
|
||||
"title": "Helen Chong's Blog",
|
||||
"subtitle": "I am writing about stuff.",
|
||||
"url": "https://helenclx.github.io/blog/",
|
||||
"feedUrl": "https://helenclx.github.io/blog/feed.xml",
|
||||
"author": {
|
||||
"name": "Helen Chong",
|
||||
"email": "helenclx@outlook.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<title>{{ metadata.title }}</title>
|
||||
<subtitle>{{ metadata.subtitle }}</subtitle>
|
||||
<link href="{{ metadata.feedUrl }}" 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 | url | absoluteUrl(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 | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
|
||||
</entry>
|
||||
{%- endfor %}
|
||||
</feed>
|
||||
Reference in New Issue
Block a user