Skip to content

Instantly share code, notes, and snippets.

@bencates
Created March 7, 2014 22:32
Show Gist options
  • Save bencates/9421593 to your computer and use it in GitHub Desktop.
Save bencates/9421593 to your computer and use it in GitHub Desktop.
Simple Jekyll plugin to convert files into directories with indexes.
module PrettyUrls
class Generator < Jekyll::Generator
def generate(site)
site.pages.each do |page|
if page.name.split('/').last !~ /^index.\w+$/
page.data['permalink'] ||= page.name.gsub(/\.\w+$/, '/index.html')
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment