Jekyll 3.2 Undefined Method Downcase Error

September 5, 2016
Category: TIL
Tags: Jekyll

I upgraded to Jekyll 3.2.1 recently and got a strange error message when I ran jekyll build:

jekyll 3.2.1 | Error:  undefined method 'downcase' for #<Hash:0x007f9c061458f8>

After some searching, I came across an open issue related to this on Github.

The issue seems to be caused by a change in 3.2 that now reserves the config key theme to specify a gem-based theme for Jekyll. This means that you can’t use the key theme in your config.yml file to specify config settings for your jekyll theme. This was a standard practice for a lot of older Jekyll themes, so I expect this to be a somewhat common problem.

For example, in my config.yml file, I had the following:

# THEME-SPECIFIC CONFIGURATION
theme:
  # Meta
  title: Chuck Grimmett
  avatar: avatar.png
  gravatar: # Email MD5 hash
  description: "Chuck Grimmett's blog" # used by search engines

The fix is to change the theme key to something else. I chose template. You not only have to change this in your config.yml file, but you also have to change anywhere that accesses it in your template files. The string you are looking for here is site.theme.* and is usually in your includes and layout files (look for folders called _includes and _layouts).

I changed that section of my config.yml to this:

# THEME-SPECIFIC CONFIGURATION
template:
  # Meta
  title: Chuck Grimmett
  avatar: avatar.png
  gravatar: # Email MD5 hash
  description: "Chuck Grimmett's blog" # used by search engines

Then I did a global search for site.theme. and replaced it with site.template.

Find this post useful?

Buy me a coffeeBuy me a coffee