Skip to content
Go to file
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!
You can’t perform that action at this time.