Skip to content

almirfilho/metalsmith-feed-atom

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

A metalsmith plugin to generate Atom feeds

Resources

License

Stars

Watchers

Forks

Packages

No packages published