Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
DocPad: Clean dates in post URLs

DocPad: Clean dates in post URLs

Creates URLs like /2012/12/15/merry-xmas for your blog posts.

Requires momentjs to be installed: npm install --save moment

# Import
moment = require('moment')
# Configuration
docpadConfig =
# =================================
# Collections
posts: ->
@getCollection('documents').findAllLive({relativeOutDirPath:'blog'},[date:-1]).on 'add', (model) ->
dateUrl = moment(model.get('date')).format("/YYYY/MM/DD")+"/"+model.get('basename')
# Export
module.exports = docpadConfig

This comment has been minimized.

Copy link

commented Apr 17, 2013

DocumentModel has no method 'setsmetaDefaults' :=)
Fix method name to setmetaDefaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.