A metalsmith plugin to generate an RSS feed for a collection.
Requires metalsmith-collections. Plays nicely with permalinks, more, and excerpts.
collections = require 'metalsmith-collections'
feed = require 'metalsmith-feed'
Metalsmith('example')
.metadata
site:
title: 'Geocities'
url: 'http://example.com'
author: 'Philodemus'
.use collections(posts: '*.html')
.use feed(collection: 'posts')
Take a look at the tests for example usage.
-
collection
string Required. The name of the configured metalsmith-collection to feed. -
limit
Number Optional. Maximum number of documents to show in the feed. Defaults to20
. Set tofalse
to include all documents. -
destination
string Optional. File path to write the rendered XML feed. Defaults to'rss.xml'
. -
postDescription
function Optional. Takes a file and returns a description string. Defaults to(file) -> file.less or file.excerpt or file.contents
-
postCustomElements
function Optional. From a file, return custom elements, like thumbnails, images, or information necessary to publish podcasts.
Remaining options are passed to the rss module as feedOptions
, along with metadata.site
.
If files have path
metadata (perhaps from permalinks) but not url
metadata, we'll prefix path
with site_url
to generate links. Feed item descriptions default to file.less
from metalsmith-more, file.excerpt
from metalsmith-excerpt, and finally the full file.contents
.