Created
December 22, 2014 19:37
-
-
Save justinmusgrove/fbbb469322a59ee93284 to your computer and use it in GitHub Desktop.
Scrub page title
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
In markdown page: | |
{% assign titleScrubbed = page[1] | scrubPageTitle %} | |
Jekyll plugin: | |
module Jekyll | |
module ScrubPageTitle | |
def scrubPageTitle(input) | |
map = {"Java -" => "", "| Level Up Lunch" => ""} | |
re = Regexp.new(map.keys.map { |x| Regexp.escape(x) }.join('|')) | |
input = input.gsub(re, map) | |
end | |
end | |
end | |
Liquid::Template.register_filter(Jekyll::ScrubPageTitle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment