Created
November 11, 2016 18:24
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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