A metalsmith plugin to generate Atom feeds
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tasks
test
.editorconfig
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
Gruntfile.js
LICENSE
README.md
package.json

README.md

metalsmith-feed-atom Build Status npm

A metalsmith plugin to generate Atom feed for a collection. If you're looking for RSS standard instead of Atom, take a look on metalsmith-feed plugin.

Requires metalsmith-collections plugin to work.

Installation

Install it via NPM:

$ npm install metalsmith-feed-atom

Usage

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

metalsmith('working/dir')
  .use(collections({articles: '*.html'}))
  .use(atomfeed({collection: 'articles'})) // make sure it comes after collections

Options

collection

Type: String (Required)
Name of the configured metalsmith-collection to build the feed from.

limit

Type: Number (Optional)
Maximum number of files to show in the feed. Defaults to 10.

destination

Type: String (Optional)
File path to write the rendered XML feed. Defaults to 'index.xml'.

metadata

Type: Object (Optional)
Metadata containing important information about your feed. Despite it isn't a required option, you must provide it in order to generate a valid Atom feed.

  • metadata.title string required: Title of your site/feed.
  • metadata.subtitle string optional: Subtitle of your site/feed.
  • metadata.url string required: Url of your site. This is also used as base url to produce files (feed entries) urls.
  • metadata.updated datetime optional: Last time your feed was updated. Defaults to the moment you generate it.

Files must have path metadata (perhaps from metalsmith-permalinks) in order to have its links outputted in the generated XML file.

Contributing

Fork this repo, install the dependecies, run the tests, submit a pull request.

$ cd metalsmith-feed-atom
$ npm install
$ grunt test

No grunt? No problem

You can run any grunt task just with npm scripts: npm run grunt -- <taskname>. Same as grunt test:

$ npm run grunt -- test

Automated workflow

You can keep the tests running automaticaly every time you make any change to the code with dev workflow:

$ grunt dev
$ npm run grunt -- dev

Always implement tests for whatever you're adding to the project. Thanks!

License

MIT © Almir Filho