1
votes

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:

  • get the :month to be in text form or
  • get the :title to be dash delimited

I remember reading somewhere that I could achieve this by writing a plugin, but I'm not sure how. How can I do this?

1
Do you ask how you can write a plugin for jekyll in general, or do you need assistance with a specific step in the plugin development? - Polygnome
@Polygnome I'd like some help writing the plugin to accomplish this (the latter). - liamzebedee
That question is way too broad to answer. What is the specific problem you are facing? - Polygnome
I'd like to get my posts to have a permalink in the form: /2013/jan/something-something-in-january. I can't do this with the vanilla permalink implementation. What are the steps to creating a plugin that would do this (i.e. what classes to extend etc.) - liamzebedee
Yes i understood that. But the question is: What prevents you from doing so? What specific problem do you face? If you don't know how to write a jekyll plugin in general, look at the jekyll wiki, it is explained there. Otherwise, at which step do you get stuck? SO is not a site where you post your problem and someone posts the source code for your plugin as solution - come up with good, specific questions, and we'll be able to help. - Polygnome

1 Answers

5
votes

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