Skip to content

Instantly share code, notes, and snippets.

@justinmusgrove
Created December 22, 2014 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinmusgrove/fbbb469322a59ee93284 to your computer and use it in GitHub Desktop.
Save justinmusgrove/fbbb469322a59ee93284 to your computer and use it in GitHub Desktop.
Scrub page title
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