Skip to content

Instantly share code, notes, and snippets.

@simlrh
Created November 11, 2016 18:24
Show Gist options
  • Save simlrh/a7df4d48da837e23299cdfdd133540f3 to your computer and use it in GitHub Desktop.
Save simlrh/a7df4d48da837e23299cdfdd133540f3 to your computer and use it in GitHub Desktop.
A quick and dirty Jekyll plugin to remove 'index.html' from the end of urls when using a clean permalink scheme
# Usage: {{ post.url | remove_index }}
module Jekyll
module RemoveIndexFilter
def remove_index(input)
url = if input
input.split("/")[0..-2].join("/") + "/"
else
input
end
url
end
end
end
Liquid::Template.register_filter(Jekyll::RemoveIndexFilter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment