Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jekyll 3.0 - Deprecations #15

Open
SteveEdson opened this issue Oct 27, 2015 · 5 comments
Open

Jekyll 3.0 - Deprecations #15

SteveEdson opened this issue Oct 27, 2015 · 5 comments

Comments

@SteveEdson
Copy link

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.

@shigeya
Copy link
Owner

shigeya commented Oct 27, 2015

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.

@SteveEdson
Copy link
Author

Yeah there's no rush. Everything appears to be working fine, it's just throwing deprecation warnings.

Thanks

@themestechnology
Copy link

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

@modulitos
Copy link

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.

@themestechnology
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants