-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
31 lines (30 loc) · 1.37 KB
/
build.js
File metadata and controls
31 lines (30 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var Metalsmith = require('metalsmith');
var collections = require('metalsmith-collections');
var layouts = require('metalsmith-layouts');
var drafts = require('metalsmith-drafts');
var markdown = require('metalsmith-markdown');
var permalinks = require('metalsmith-permalinks');
Metalsmith(__dirname) // __dirname defined by node.js:
// name of current working directory
.metadata({ // add any variable you want
// use them in layout-files
sitename: "My Static Site & Blog",
siteurl: "http://example.com/",
description: "It's about saying »Hello« to the world.",
generatorname: "Metalsmith",
generatorurl: "http://metalsmith.io/"
})
.source('./src') // source directory
.destination('./build') // destination directory
.clean(true) // clean destination before
.use(collections({ // group all blog posts by internally
posts: '*.md' // adding key 'collections':'posts'
})) // use `collections.posts` in layouts
.use(drafts())
.use(markdown()) // transpile all md into html
.use(layouts({
"default": "default.hbs"
})) // wrap layouts around html
.build(function(err) { // build process
if (err) throw err; // error handling is required
});