metalsmith-sections v1.0.0
metalsmith-sections
This is a plugin for Metalsmith that splits up your content into sections and sub sections.
The goal is to easily loop through files in a simple file structure in an ordered way.
Usage
A section corresponds to a folder and a sub section to a file in that folder.
For the sub sections to appear, they must have a subsectionIndex attribute
set in the YAML front-matter. This index is also what defines the order in
which the sub sections are sorted.
If using the CLI for Metalsmith, metalsmith-sections can be used like any other
plugin by including it in metalsmith.json. For example:
{
"plugins": {
"metalsmith-sections": {
"name": "sections"
}
}
}For Metalscript's JavaScript API, metalsmith-sections can be used like any other plugin, by attaching it to the function invocation chain on the Metalscript object. For example:
var sections = require('metalsmith-sections');
require('metalsmith')(__dirname)
.use(sections({
name: 'sections'
})
.build();Options
There is only one option, which is optional:
namedefines under which attribute the section tree will be created. Default name issections.
License
MIT, see LICENSE.
11 years ago