A Metalsmith plugin to replace Handlebar partials in the layouts and applys layouts to the files. Clone of metalsmith-layouts
$ npm install gobha-template
let template = require('gobha-template')
metalsmith.use(template()){
direcory: "layouts",
extension: "html|php|md|hbs",
partialExtension: ".hbs",
partials: "partials"
}Defines the root folder of the layouts, based on the directory where metalsmith is executed.
The plugin checks every file extension and when the extension matches the regex it will process the file and replace the partials in this file
Defines which extension the templates have, othewise they will be ignored
Defines the root folder of the partials, based on the directory where metalsmith is executed.
It will search in all files and folder in the partials folder
create a new file empty.hbs in the layout folder
Now you can place the meta information inside your file to set the layout from the layout directory
---
layout: empty.hbs
---Don't forget to add the partial, we used in the head of the layout
Please see my other plugin, it works the same way but only for the files itself gobha-partials
MIT