A metalsmith plugin to generate an RSS feed for a collection
CoffeeScript
Latest commit 4cad8a1 Sep 30, 2015 @hurrymaplelad 0.2.0

README.md

metalsmith-feed NPM version Build Status

A metalsmith plugin to generate an RSS feed for a collection.

Requires metalsmith-collections. Plays nicely with permalinks, more, and excerpts.

Usage

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')

Options

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 to 20. Set to false 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.