-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.js
40 lines (38 loc) · 1023 Bytes
/
build.js
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
32
33
34
35
36
37
38
39
40
const Metalsmith = require('metalsmith');
const markdown = require('metalsmith-markdown');
const layouts = require('metalsmith-layouts');
const collections = require('metalsmith-collections');
const permalinks = require('metalsmith-permalinks');
const handlebars = require('handlebars');
const fs = require('fs');
// Navigation
handlebars.registerPartial('navigation', fs.readFileSync(__dirname + '/layouts/partials/navigation.hbt').toString());
Metalsmith(__dirname)
.source('src')
.destination('public')
.use(collections({
articles: {
pattern: 'articles/*.md',
},
}))
.use(markdown())
.use(permalinks({
pattern: ':collection/:title'
}))
.use(layouts({
engine: 'handlebars',
directory: './layouts',
default: 'article.html',
pattern: ["*/*/*html", "*/*html", "*html"],
partials: {
navigation: 'partials/navigation',
}
}))
.build(function (err) {
if (err) {
console.error(err)
}
else {
console.log('build completed!');
}
});