-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
76 lines (58 loc) · 1.95 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var metalSmith = require('metalsmith');
var markdown = require('metalsmith-markdown');
var templates = require('metalsmith-templates');
var collections = require('metalsmith-collections');
var permalinks = require('metalsmith-permalinks');
var sass = require('metalsmith-sass');
var navigation = require('./custom/navigation');
var metalias = metalSmith(__dirname); //all paths are relative to __dirname (or whatever you pass here)
var buildSuccess = function buildSuccess(err) {
console.log('Site built successfully...', err);
};
var buildFail = function buildFail(err) {
console.log('Error: ', err);
};
var meta = {
title: 'MetalSmith-Demo',
description: 'Metal with care.',
// used by metalsmith-templates
partials: {
breadcrumbs: 'partials/breadcrumbs',
header : 'partials/header',
footer : 'partials/footer',
navigation : 'partials/navigation',
navigationItem : 'partials/navigationItem'
}
};
//As far as I can tell, the only order that matters is that the .build(fnE, fnS) method is called last.
metalias
// MetalSmith's default clean option is true.
//.clean(true)
// MetalSmith's default source folder is the src directory
//.source('./src')
// MetalSmith's default destination is the build directory
.destination('./build')
.use(collections({
pages: {
pattern: 'content/pages/*.md'
},
posts: {
pattern: 'content/posts/*.md',
sortBy: 'date',
reverse: true
}
}))
.metadata(meta)
.use(sass({
outputStyle: 'expanded'
}))
.use(markdown())
.use(permalinks({
pattern: ':collection/:title'
}))
//.use(permalinks())
.use(navigation())
.use(templates('swig'))
// the build method must be passed at least callback function to succeed. Without these functions, no error is thrown and it's very annoying.
.build(buildFail, buildSuccess)
;