Creates URLs like /2012/12/15/merry-xmas.html
for your blog posts.
Requires momentjs to be installed: npm install --save moment
# Import | |
moment = require('moment') | |
# Configuration | |
docpadConfig = | |
# ================================= | |
# Collections | |
collections: | |
posts: -> | |
@getCollection('html').findAllLive({relativeOutDirPath:'archives'},[{date:-1}]).on 'add', (model) -> | |
dateUrl = '/archives' + moment(model.get('date')).format('/YYYY/MM/DD') + '/' + model.get('basename') | |
model.addUrl(dateUrl).setMetaDefaults({url: dateUrl}) | |
model.setMetaDefaults({layout: 'post'}) | |
# Export | |
module.exports = docpadConfig |