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

Deprecation errors using categories and category #35

Open
egeis opened this Issue Sep 26, 2016 · 12 comments

Comments

Projects
None yet
8 participants
@egeis
Copy link

egeis commented Sep 26, 2016

Every time I specify a category in paginate I run across this error during building.

document#categories is now a key in the #data hash
octopress-paginate.rb:148 in 'block in collection'

Using following settings:

layout: post
paginate:
  collection: posts
  category: general

After spending the last hour changing settings it seems to error out on both categories and category.

@brandonb927

This comment has been minimized.

Copy link

brandonb927 commented Sep 30, 2016

I have migrated from jekyll-paginate to octopress-paginate and I seem to be running into this issue as well. I don't know ruby well enough to submit a PR so any help would be great!

@egeis

This comment has been minimized.

Copy link

egeis commented Oct 5, 2016

I managed to apply one of the pull requests changes to categories and tags to my own fork then use that in the gem file. I can finally see the errors im getting. Noticed this plugin does not function from a page that is generated from another generator....

@straversi

This comment has been minimized.

Copy link

straversi commented Oct 11, 2016

Same for using the tag key: Document#tags is now a key in the #data hash.

@jdesiloniz

This comment has been minimized.

Copy link

jdesiloniz commented Nov 28, 2016

It's happening to us too, after applying pagination to blog posts with categorization.

@gluttonousbear

This comment has been minimized.

Copy link

gluttonousbear commented Jul 24, 2017

The same happens for me with github-pages. Neither Tags, nor Categories (or their singular) work. octopress-paginate is the only plugin I am using. I am building the site locally with Ruby and pushing the _site/ folder to github pages.

In its current form, octopress-paginate cannot do more for me than the basic Jekyll functionality.

I might try to use collections instead and report back whether or not that worked.

@gluttonousbear

This comment has been minimized.

Copy link

gluttonousbear commented Jul 25, 2017

Update: The deprecation issue does not seem to appear when using collections. However, while the locally generated site paginates collections, the live github version will simply not accept any collection pagination. The interaction between github pages and octopress-paginate is definitely a strange one.

@aprilmintacpineda

This comment has been minimized.

Copy link

aprilmintacpineda commented Aug 12, 2017

I just used this paginate plugin and I am encountering the same warning saying:

Deprecation: Document#categories is now a key in the #data hash.
Deprecation: Called by ["C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-3.5.1/lib/jekyll/document.rb:374:in `method_missing'"].

My code:

---
layout: default
page_title: how-tos
paginate: true
paginate:
  categories: [how-tos]
  collection: posts
  per_page: 1
  limit: false
  permalink: /:num/
---

<div class="post-list-container limited-width">
  {% for post in paginator.posts %}
    <article class="post load-defaults">
      <img src="/blog/public/post-resources/{{ post.cover_image }}">
      <header>
        <h1>{{ post.title }}</h1>
        <p><strong>Date posted:</strong> {{ post.date_posted | date: '%B, %d, %Y' }}</p>
        <p><strong>Category:</strong> {{ post.category }}</p>
      </header>
      <section>
        <p>{{ post.description }}</p>
        <p><a href="/blog{{ post.url }}">Read more</a></p>
      </section>
    </article>
  {% endfor %}

  <div class="pages">
    {% for i in (1..paginator.total_pages) %}
      {% if i == 1 %}
        {% if i == paginator.page %}
          <a class="onlink" href="/blog/category/how-tos/">{{ i }}</a>
        {% else %}
          <a href="/blog/category/how-tos/">{{ i }}</a>
        {% endif %}
      {% else %}
        {% if i == paginator.page %}
          <a class="onlink" href="/blog/category/how-tos/{{ i }}">{{ i }}</a>
        {% else %}
          <a href="/blog/category/how-tos/{{ i }}">{{ i }}</a>
        {% endif %}
      {% endif %}
    {% endfor %}
  </div>
</div>

Any updates about this?

@aprilmintacpineda

This comment has been minimized.

Copy link

aprilmintacpineda commented Aug 12, 2017

Update: I just pushed my jekyll project on github, I think it was affected by the deprecation warning and now it doesn't show any post at all. In short, pagination does not work. It works on my local machine by the way.

https://aprilmintacpineda.github.io/blog/category/all/

This was referenced Aug 13, 2017

@aprilmintacpineda

This comment has been minimized.

Copy link

aprilmintacpineda commented Aug 13, 2017

For those looking to paginate their posts based on category, I suggest using the collection for now while the pagination by category is still encountering the error.

@jhummel

This comment has been minimized.

Copy link

jhummel commented Oct 25, 2017

Running into this same deprecation warning on paginating tags. It does finish the build, it's just a lot of terminal spam.

@armcknight

This comment has been minimized.

Copy link

armcknight commented Jul 3, 2018

I had the same problem and seem to have fixed it. Here is my usage before that presented the same problem as others describe here ("Document#categories is now a key in the #data hash.").

A sample collection item, before the fix:

---
index: 0
image_url: IMG_0045.jpg
description: "The drive to Big Bend."
thumbnail_url: IMG_0045-thumbnail.jpg
thumbnail_width: 150
date: October 24, 2017
album: 2017-10-24-big-bend-national-park
category: 2017-10-24-big-bend-national-park # <-- offending line
---

and after:

---
index: 0
image_url: IMG_0045.jpg
description: "The drive to Big Bend."
thumbnail_url: IMG_0045-thumbnail.jpg
thumbnail_width: 150
date: October 24, 2017
album: 2017-10-24-big-bend-national-park
# ↓ the proper usage
data:
  category: 2017-10-24-big-bend-national-park
---

And the page that was paginating items of this collection, before:

---
paginate:
  collection: photos
  category: 2017-10-24-big-bend-national-park # <-- offending line
  per_page: 1
  limit: false
  permalink: /:num/
---

and after:

---
paginate:
  collection: photos
  # ↓ start fix
  data:
    category: 201 2017-10-24-big-bend-national-park
  # ↑ end fix
  per_page: 1
  limit: false
  permalink: /:num/
---
@armcknight

This comment has been minimized.

Copy link

armcknight commented Jul 3, 2018

Sorry, but what I just posted doesn't actually work. It just caused a silent failure. At least it didn't show the deprecation warnings ;P

What I'd done prior to this is to separate out the deprecation warnings from console output to a file, which I checked in and then can at least see if there are changes in the deprecation messages if it gets dirtied in the git index: jekyll build 2>deprecations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment