Skip to content

Instantly share code, notes, and snippets.

@flipjs
Created July 28, 2014 22:58
Show Gist options
  • Save flipjs/d65e87cb4d689e937ebe to your computer and use it in GitHub Desktop.
Save flipjs/d65e87cb4d689e937ebe to your computer and use it in GitHub Desktop.
Metalsmith config sample
var Metalsmith = require('metalsmith')
, markdown = require('metalsmith-markdown')
, templates = require('metalsmith-templates')
, Handlebars = require('handlebars')
, fs = require('fs')
, collections = require('metalsmith-collections')
, permalinks = require('metalsmith-permalinks')
Handlebars.registerPartial('header', fs.readFileSync(__dirname + '/templates/partials/header.hbt').toString())
Handlebars.registerPartial('footer', fs.readFileSync(__dirname + '/templates/partials/footer.hbt').toString())
Metalsmith(__dirname)
.use(collections({
pages: {
pattern: 'content/pages/*.md'
},
posts: {
pattern: 'content/posts/*.md',
sortBy: 'date',
reverse: true
}
}))
.use(markdown())
.use(permalinks({
pattern: ':collection/:title'
}))
.use(templates('handlebars'))
.destination('./build')
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment