1.0.0 • Published 10 years ago
metalsmith-feed-atom v1.0.0
metalsmith-feed-atom
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.
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 collectionsOptions
collectionstring required: Name of the configured metalsmith-collection to build the feed from.limitnumber optional: Maximum number of files to show in the feed. Defaults to 10.destinationstring optional: File path to write the rendered XML feed. Defaults to 'index.xml'.metadataobject 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.titlestring required: Title of your site/feed.metadata.subtitlestring optional: Subtitle of your site/feed.metadata.urlstring required: Url of your site. This is also used as base url to produce files (feed entries) urls.metadata.updateddatetime 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 testNo grunt? No problem
You can run any grunt task just with npm scripts: npm run grunt -- <taskname>.
Same as grunt test:
$ npm run grunt -- testAutomated 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 -- devAlways implement tests for whatever you're adding to the project. Thanks!
License
MIT © Almir Filho