Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including metalsmith-feed with all npm packages installed. Try it out:

var metalsmithFeed = require("metalsmith-feed")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

metalsmith-feed v1.0.0

A metalsmith plugin to generate an RSS feed for a collection


npm Build Status Code Style: prettier

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

Just a thin wrapper around the rss module.

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


const collections = require('metalsmith-collections');
const feed = require('metalsmith-feed');

    (site: {
      title: 'Geocities',
      url: '',
      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 to 20. Set to false to include all documents.

  • destination string Optional. File path to write the rendered XML feed. Defaults to 'rss.xml'.

  • preprocess function Optional. Map collection entries to RSS items. Some fields (like description and url) have default mappings that support Metalsmith plugin conventions. Many other fields (like title, author, and date) work great without any customization. You can customize any of these fields in preprocess.

        collection: 'posts',
        preprocess: file => ({
          // Make all titles uppercase
          title: file.title.toUpperCase()
    description: ...
    Description defaults to `file.less` from metalsmith-more,
    `file.excerpt` from metalsmith-excerpt, and finally the
    full `file.contents`

url: ... If files have path metadata (perhaps from metalsmith-permalinks) but not url metadata, we'll prefix path with site_url to generate links. */ }) }) );

Remaining options are passed to the [rss]( module as `feedOptions`, along with ``.

### Multiple Feeds

Have a few collections you'd like to export? Register this plugin once for each:

    foo: 'foo/*.html',
    bar: 'bar/*.html'
    collection: 'foo',
    destination: 'foo-rss.xml'
    collection: 'bar',
    destination: 'bar-rss.xml'
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free