metalsmith-metadata-as-list
v0.1.0
Published
A metalsmith plugin to split a metadata field into a list by a delimiter.
Downloads
13
Maintainers
Readme
metalsmith-metadata-as-list
A metalsmith plugin to split a metadata field into a list at delimiter.
Installation
$ npm install metalsmith-metadata-as-listDescription in Pages
In your pages:
---
title: This is page with tags
tags: tagged, page, metalsmith, plugin
---
Hello WorldYou can use different handle for the tags, by configuring the handle option. tags is the default.
CLI Usage
Install the node modules and then add the metalsmith-tags key to your metalsmith.json plugins. The simplest use case just requires tag handle you want to use:
{
"plugins": {
"metalsmith-metadata-as-list": {
"handle": "tags",
}
}
}JavaScript Usage
Pass the plugin to Metalsmith#use:
var split = require('metalsmith-metadata-as-list');
metalsmith
.use(split({
handle: 'tags', // yaml key for tag list in you pages
path:'topics/:tag.html', // path for result pages
template:'/partials/tag.hbt', // template to use for tag listing
sortBy: 'date', // provide posts sorted by 'date' (optional)
reverse: true // sort direction (optional)
}));Contribution
Feel free to contribute to this plug-in. Fork, commit, send pull request. Issues, suggestions and bugs are more than welcome.
In case you add functionality, please write corresponding test. Test using npm test.
Thanks!
License
MIT
