Skip to content

Instantly share code, notes, and snippets.

@fizzvr
Forked from balupton/docpad.coffee
Created April 17, 2013 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fizzvr/5406981 to your computer and use it in GitHub Desktop.
Save fizzvr/5406981 to your computer and use it in GitHub Desktop.
# Define our Configuration
docpadConfig =
# Define our own Collections
collections:
# Posts
# Anything outputted to the posts directory can be considered a post
# Sort the posts by newest first
# And set their layout to `post` automatically if it isn't already set
posts: (database) ->
database.findAllLive({relativeOutDirPath:'posts'},[date:-1]).on('add', (document) ->
document.setMetaDefaults(layout:'post') unless document.get('layout')
)
# instead of database, you can also use @getCollection('documents') or whatever
# if the content you are filtering are just documents (will be faster if this is the case)
# Export our Configuration
module.exports = docpadConfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment