Open egeis opened 8 years ago
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!
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....
Same for using the tag key: Document#tags is now a key in the #data hash.
It's happening to us too, after applying pagination to blog posts with categorization.
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.
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.
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'"].
---
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?
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.
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.
Running into this same deprecation warning on paginating tags. It does finish the build, it's just a lot of terminal spam.
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/
---
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
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:
After spending the last hour changing settings it seems to error out on both categories and category.