eleventy-rss-helper
Create RSS 2.0 feeds for an Eleventy site.
This is a wrapper around the rss module.
Install
npm install eleventy-rss-helper
Usage
1. Create feed file
Create a feed file (e.g. feed.11ty.js
) in a directory that Eleventy will process.
Paste this boilerplate into the file:
const createRssFeed = ; moduleexports = ;
2. Fill in the empty functions
feedOptions(data)
Receives
- Eleventy data object
Returns object to be used as feedOptions with the rss module.
items(collections, data)
Receives
- Eleventy collections object
- Eleventy data object
Returns array of items to include in the feed.
itemOptions(item, data)
Invoked once for each element in array returned by items()
.
Receives
- An item from the array returned by your
items()
function - Eleventy data object
Returns object to be used as itemOptions with the rss module.
Example
const createRssFeed = ; const permalink = '/feed.xml';const baseUrl = 'https://mysite.com'; moduleexports = ;
License
MIT