Added RSS feed
This commit is contained in:
parent
a4a4944084
commit
d524e98843
|
@ -1,9 +1,11 @@
|
|||
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation')
|
||||
const pluginRss = require('@11ty/eleventy-plugin-rss')
|
||||
|
||||
const { DateTime } = require('luxon')
|
||||
|
||||
module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPlugin(eleventyNavigationPlugin)
|
||||
eleventyConfig.addPlugin(pluginRss)
|
||||
|
||||
eleventyConfig.addLayoutAlias('page', 'layouts/page')
|
||||
eleventyConfig.addLayoutAlias('article', 'layouts/article')
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
"name": "firstname lastname",
|
||||
"email": "hello@blog.com"
|
||||
},
|
||||
"image": "/assets/social-image.jpg"
|
||||
"image": "/assets/social-image.jpg",
|
||||
"feedUrl": "https://eleventy-not-so-minimal-blog-starter.netlify.app/feed.xml"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
permalink: /feed.xml
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<title>{{ metadata.title }}</title>
|
||||
<subtitle>{{ metadata.summary }}</subtitle>
|
||||
<link href="{{ metadata.feedUrl }}" rel="self"/>
|
||||
<link href="{{ metadata.url }}"/>
|
||||
<updated>{{ collections.blog | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
|
||||
<id>{{ metadata.url }}</id>
|
||||
<author>
|
||||
<name>Claudia R</name>
|
||||
</author>
|
||||
|
||||
{%- for article in collections.blog -%}
|
||||
{% set absolutePostUrl %}{{ article.url | url | absoluteUrl(metadata.url) }}{% endset %}
|
||||
<entry>
|
||||
<title>{{ article.data.title }}</title>
|
||||
<link href="{{ absolutePostUrl }}"/>
|
||||
<updated>{{ article.date | dateToRfc3339 }}</updated>
|
||||
<id>{{ absolutePostUrl }}</id>
|
||||
{% set excerpt = article.data.excerpt %}
|
||||
<content type="html">{{ excerpt | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
|
||||
</entry>
|
||||
{%- endfor -%}
|
||||
</feed>
|
Loading…
Reference in New Issue