A Metalsmith plugin to generate navigations in metalsmith from meta informations
$ npm install gobha-navigation
let navigation = require('gobha-navigation')
metalsmith.use(navigation())
{
extension: "html|php|md|hbs"
}
The plugin checks every file extension and when the extension matches the regex it will process the file and change the file extension
Just add a new meta information into the file itself to create a new navigation
---
nav: main
---
The text "main" is the name of the navigaton
Now you can access the navigation main in your templates
Inside the loop you can access the url of the file via{{file}}
and the title via {{title}}
To set an order for the files in the navigation add the sign =
followed by a index(number) to the meta informationen in the file.
---
nav: main=10
---
1 is the first file, 2 the second and so on...
If you add a number twice it uses the order in which the files are processed
MIT