Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (20 sloc) 836 Bytes
module.exports = (env, callback) ->
defaults =
postsDir: 'articles' # directory containing blog posts
template: 'article.jade'
filenameTemplate: '/:year/:month/:day/:file/index.html'
# assign defaults for any option not set in the config file
options = or {}
for key, value of defaults
options[key] ?= defaults[key]
class BlogpostPage extends env.plugins.MarkdownPage
### DRYer subclass of MarkdownPage ###
getTemplate: ->
@metadata.template or options.template or super()
getFilenameTemplate: ->
@metadata.filenameTemplate or options.filenameTemplate or super()
# register the plugin
prefix = if options.postsDir then options.postsDir + '/' else ''
env.registerContentPlugin 'posts', prefix + '**/*.*(markdown|mkd|md)', BlogpostPage
# done!