Daniel Miller

Title Case All Posts in Jekyll

After messing around with the design of this blog the other day, I decided I needed to title case all my post titles, because I’m terrible about consistency in that area. I did my best googling, and did not find any suitable answer, so I’m providing one here.

Install the titleize Ruby gem. Then in _plugins/my_plugins.rb, add a pre_render hook (I tried tags but failed to get them to work).

require "titleize"

Jekyll::Hooks.register :posts, :pre_render do |post|
  post.data["title"].titleize!
end

112 words