avillafiorita / jekyll-datapage_gen

Generate one page per yaml record in Jekyll sites.
369 stars 80 forks source link

Example of using the paginatehook property? #80

Open iamalfonse opened 4 years ago

iamalfonse commented 4 years ago

So I can see that there is a paginatehook property that can be enabled in the options (but not noted in the documentation). I'm just curious if there's a good example of how I'm able to use jekyll's pagination with the datapage-gen.

This is how I tried to set it up locally.

config.yml

page_gen:
  - data: blog
    index_files: true
    template: blog-post
    name: slug
    dir: blog
    paginatehook: true

pagination:
  enabled: true
  per_page: 5
  permalink: '/page/:num/'
  title: ' - page :num'
  limit: 0                # number of pages. 0 = all
  sort_field: 'date'
  sort_reverse: true

_layouts/blog-post

---
title: 'Blog'
pagination:
  enabled: true
---

{% for post in paginator.posts %}
<p>{{ post }}</p>
{% endfor %}

But it shows me posts found in other _posts directory instead of anything from the data found in the blog data. Any ideas?

avillafiorita commented 4 years ago

Hi - it is the result of an old merge. Pagination could be more easily achieved with a specific option for the plugin, in my opinion. Planned for next release.