I'm writing a Jekyll setup and I'd like to get my posts to have a permalink in the form: /2013/jan/something-something-in-january
. I understand that it is impossible with vanilla permalinks to:
:month
to be in text form or :title
to be dash delimitedI remember reading somewhere that I could achieve this by writing a plugin, but I'm not sure how. How can I do this?
I created a generator plugin:
module Jekyll
class PermalinkRewriter < Generator
safe true
priority :low
def generate(site)
# Until Jekyll allows me to use :slug, I have to resort to this
site.posts.each do |item|
item.data['permalink'] = '/' + item.slug + '/'
end
end
end
end