Skip to content

Instantly share code, notes, and snippets.

@jhyland87
Created November 8, 2016 18:43
Show Gist options
  • Save jhyland87/6409cbf065200b916d4cbd66f401f3bb to your computer and use it in GitHub Desktop.
Save jhyland87/6409cbf065200b916d4cbd66f401f3bb to your computer and use it in GitHub Desktop.
Metalsmith Example
const Metalsmith = require('metalsmith')
const collections = require('metalsmith-collections')
const markdown = require('metalsmith-markdown')
const layouts = require('metalsmith-layouts')
const permalinks = require('metalsmith-permalinks')
const tidy = require('metalsmith-html-tidy')
const debug = require('metalsmith-debug')
const models = require('metalsmith-models')
const within = require('metalsmith-handlebars-within')
Metalsmith(__dirname)
.use(debug())
.metadata({
title: "My Static Site & Blog",
description: "It's about saying »Hello« to the World.",
generator: "Metalsmith",
url: "http://www.metalsmith.io/"
})
.metadata(require('./meta'))
.source('./src')
.destination('./build')
.use(models({ directory: './models' }))
.clean(true)
.use(markdown())
.use(permalinks())
.use(within())
.use(layouts({ engine: 'handlebars' }))
.use(tidy({
tidyOptions: {
'indent-spaces': 4
,'clean': true
,'output-html': true
,'hide-comments': true
,'show-errors': 6
,'show-info': true
,'show-warnings': true
,'uppercase-attributes': false
,'uppercase-tags': false
},
}))
.build(function(err, files) {
if (err) { throw err; }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment