A pack of Eleventy plugins for generating an RSS feed using the Nunjucks templating engine.
Installation
Available on npm.
npm install @11ty/eleventy-plugin-rss --save
Open up your Eleventy config file (probably .eleventy.js
) and use addPlugin
:
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
};
Read more about Eleventy plugins.
Usage
See sample/feed.njk
for an example RSS (actually Atom ¯\_(ツ)_/¯
) feed template.
Supplies: Nunjucks Filters
rssLastUpdatedDate
: Gets the most recently updated content in the collection and retrieves the properly formatted Date for the top-level <updated>
element.rssDate
: format a Date to be used for individual <entry><updated>
elements.absoluteUrl
: converts a single URL (relative or absolute path) to a full absolute URL including protocol, domain, full path.htmlToAbsoluteUrls
: transforms all of the URLs in a block of HTML with absoluteUrl
above. Uses posthtml-urls with a[href]
, video[src]
, audio[src]
, source
, img[src]
, [srcset]
and a whole bunch more.