-
Notifications
You must be signed in to change notification settings - Fork 0
/
metalsmith-config.js
54 lines (49 loc) · 1.54 KB
/
metalsmith-config.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
//This is the config for the metalsmith blog engine
//metalsmith requires
var Metalsmith = require('metalsmith')
var drafts = require('metalsmith-drafts');
var markdown = require('metalsmith-markdown');
var permalinks = require('metalsmith-permalinks');
var templates = require('metalsmith-templates');
var assets = require('metalsmith-assets');
var tags = require('metalsmith-tags');
var collections = require('metalsmith-collections');
//other requires
var handleHelpers = require('./handlebars-helpers') //also requires fs and moment
/* Blog engine setup */
module.exports = {
setup: function(){
return Metalsmith(__dirname)
.use(drafts())
.use(tags({
handle: 'tags',
path:'topics/:tag.html',
template: 'tag.hbt',
sortBy: "date",
reverse : true
}))
.use(markdown())
.use(collections({
articles: {
pattern: './published/*.md',
sortBy: 'date',
reverse: true
}
}))
.use(permalinks('posts/:title'))
.use(templates('handlebars'))
.use(assets({
source: './assets',
destination: './assets'
}))
.destination('./build')
.build(function(err, files) {
if (err) {
console.log(err)
throw err;
} else{
console.log("Build was successful")
}
});
}
}