octopress / paginate

A simple paginator for Jekyll sites.
MIT License
105 stars 37 forks source link

Collection is always empty #41

Closed aprilmintacpineda closed 7 years ago

aprilmintacpineda commented 7 years ago

Documentation is extremely poor and is hard to understand for beginners like me. First I tried to paginate by category but a deprecation warning occurred -> #35

Now I tried to paginate by collection but the paginator.collection_name is always empty even if there is a post in it.

Folder structure

root
- collection/
--- _howtos/
------ how-to-remove-virus.md
--- howtos.html

howtos.html

---
layout: default
page_title: how-tos
paginate: true
paginate:
  collection: howtos
  per_page: 1
  limit: false
  permalink: /:num/
---

{{ paginator }}

Output:

{"howtos"=>[], "page"=>1, "per_page"=>1, "limit"=>false, "total_howtos"=>0, "total_pages"=>0, "previous_page"=>nil, "previous_page_path"=>nil, "next_page"=>nil, "next_page_path"=>nil}
aprilmintacpineda commented 7 years ago

I get it, my folder structure was wrong:

root
- _howtos # all posts goes inside this folder

And now it works.

{"howtos"=>[#], "page"=>1, "per_page"=>1, "limit"=>false, "total_howtos"=>1, "total_pages"=>1, "previous_page"=>nil, "previous_page_path"=>nil, "next_page"=>nil, "next_page_path"=>nil}