New to Jekyll converting a WordPress blog I'm trying to add pagination to my category layout. In _layouts
directory I've created a file named category.html. I can successfully render a particular category with:
category.html:
---
layout: default
---
{% assign catName = page.title | string %}
{% for post in site.categories[catName] %}
<p>{{ post.title }}</p>
{% endfor %}
When I try to paginate a category's posts after following Jekyll's Pagination documentation:
{% for foobar in paginator.posts %}
<p>{{ foobar.title }}</p>
{% endfor %}
the code renders nothing. Upon my research Github Pages limits what plugins can be used and I cannot verify if jekyll-paginate-v2 is allowed.
My file structure:
_config.yml:
plugins:
- jekyll-feed
## - jekyll-paginate-v2
- jekyll-paginate
exclude:
- Gemfile
- Gemfile.lock
collections:
category:
output: true
defaults:
scope:
path: ""
type: category
values:
layout: "category"
paginate: 1
paginate_path: "/page:num/"
Gemfile:
gem "github-pages", group: :jekyll_plugins
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
## gem "jekyll-paginate-v2", "~> 1.7"
gem "jekyll-paginate"
end
Research:
- Upgrade Jekyll 3 - jekyll-paginate
- Pagination
- jekyll-paginate-v2
- Generate category page in jekyll targeting github pages
- Jekyll paginate
For a Jekyll site on Github Page how can I create pagination for the category to render only posts for that category? This would be the equivelent to WordPress' category.php.