-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
51 lines (50 loc) · 1.05 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
var metalsmith = require('metalsmith');
var markdown = require('metalsmith-markdown');
var layouts = require('metalsmith-layouts');
var collections = require('metalsmith-collections');
var permalinks = require('metalsmith-permalinks');
var partials = require('metalsmith-discover-partials');
var drafts = require('metalsmith-drafts');
metalsmith(__dirname)
.metadata({
site: {
name: 'Dev Blog',
description: "Matt codes and now he wants to write about it."
}
})
.source('./src')
.destination('./public')
.use(partials({
directory: 'layouts/partials',
pattern: /\.hbs$/
}))
.use(drafts())
.use(collections({
articles: 'articles/*.md'
}))
.use(markdown())
.use(permalinks({
duplicatesFail: true,
relative: 'folder',
linksets: [
{
match: { collection: 'articles' },
pattern: 'blog/:title',
date: 'YYYY/MM'
}
]
}))
.use(layouts({
engine: 'handlebars',
directory: 'layouts',
pattern: '**/*.html',
default: 'default.hbs'
}))
.build(function (err) {
if(err) {
console.log(err);
}
else {
console.log('Blog built!');
}
});