How to fix "Deprecation: Document#categories is now a key in the #data hash."

I’m building my jekyll site and getting this warning:

8:58:41 AM:        Deprecation: Document#categories is now a key in the #data hash.
8:58:41 AM:        Deprecation: Called by ["/opt/build/cache/bundle/ruby/2.6.0/gems/jekyll-4.0.0/lib/jekyll/document.rb:400:in `method_missing'"].

How do I fix it?

Hello @flyingfisch!
Are you using any plugins? If yes, please list them.
Are you using a theme-gem? (check for key theme: in your config file) If yes, please post its name.

I am not using a theme gem that I am aware of. I am using the following plugins:


Most of those are custom plugins, it may help just to link the source code:

The following definition was found in the category_archive plugin:

def posts_group_by_category(site)
  category_map = {} {|p| p.categories.each {|c| (category_map[c] ||= []) << p } }

Within the outer braces on line#3 above is the usage p.categories.each
This usage is deprecated and not recommended since Jekyll 3.0 and above. The recommended approach is to use['categories'].each instead.

Thank you! That solved the problem. :slight_smile: