jekyll-category-archive-plugin
jekyll-category-archive-plugin copied to clipboard
Jekyll 3.0 - Deprecations
Sorry if this is a known issue, but since Jekyll 3.0, the following warnings appear:
Deprecation: Collection#each should be called on the #docs array directly.
Called by /home/rof/src/bitbucket.org/SteveEdson/steveedson/_plugins/category_archive_plugin.rb:38:in `posts_group_by_category'.
Deprecation: Document#categories is now a key in the #data hash.
Called by /home/rof/src/bitbucket.org/SteveEdson/steveedson/_plugins/category_archive_plugin.rb:38:in `block in posts_group_by_category'.
Thanks.
Hi. I haven't tested with Jekyll 3.0. Thus there must be some compatibility. I, of course, need to upgrade to 3.0. Will look into the issue possibly later this week.
Yeah there's no rush. Everything appears to be working fine, it's just throwing deprecation warnings.
Thanks
Hello did this ever get sorted out as Im stuck upgrading a plugin.
I have added docs to site.posts.docs.each for Jekyll 3 but "categories.each" still break
def posts_group_by_category(site)
category_map = {}
site.posts.docs.each do |p|
p.categories.each do |c|
(category_map[c] ||= []) << p
end
end
category_map
end
It looks like this has been fixed in PR #17 although that PR hasn't been merged yet. I am using the Phlow Feeling Responsive theme, which uses jekyll-paginate and Jekyll 3, so I had this same issue. PR #17 fixes this issue for me.
The solution was p['categories'].each for me
def posts_group_by_category(site)
category_map = {}
site.posts.docs.each do |p|
p['categories'].each do |c|
(category_map[c] ||= []) << p
end
end
category_map
end