Skip to content

Instantly share code, notes, and snippets.

Created November 20, 2010 15:44
Show Gist options
  • Save ilkka/707909 to your computer and use it in GitHub Desktop.
Save ilkka/707909 to your computer and use it in GitHub Desktop.
Jekyll archive page generator plugin
module Jekyll
class ArchiveGenerator < Generator
safe true
def generate(site)
collate_by_month(site.posts).each do |month, posts|
page =, month, posts)
site.pages << page
def collate_by_month(posts)
collated = {}
posts.each do |post|
key = "#{}/#{}"
if collated.has_key? key
collated[key] << post
collated[key] = [post]
Copy link

@ikka the same is true with ruby 1.9.3

Copy link

blacksd commented Aug 11, 2013

I have this output too with ruby 1.9.3 and latest jekyll.

Copy link

nlindley commented Sep 2, 2013

The default year/month format doesn’t match Jekyll’s because the months aren’t getting zero-padded. You can see my fix here:

To those having problems with the warning, having ArchivePage inherit Page seems to fix the issues. See this gist:

Copy link

@nlindley This is a simple question, but when I run 'jekyll build' the file loads but none of the methods are ever called. The file is in my _layouts folder, and I know it's getting loaded, but none of the methods fire. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment