Skip to content
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

reads pagination also from include and layout. remove posts subfield. #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cengique
Copy link

@cengique cengique commented Mar 7, 2021

I edited pagination.html to read the paginator parameter from a number of places. It really can't read from page because of all the nested layouts.

I also had to flatten it and pass the posts array directly. Otherwise, I could not figure out how to send a filtered dynamic list of posts to it. So now I could call it like this:

  {% assign posts_no_posters = site.categories.CAT | where_exp: "post", "post.categories != 'posters'" %}
  {% include views/pagination2.html paginator=posts_no_posters %}

I searched in your code to see if there was a specific use case for your version. Does this break compatibility with code that you have?

Copy link
Owner

@jeffreytse jeffreytse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain further more to me? Thanks and regards

@@ -1,14 +1,19 @@
{%- if page.paginator -%}
{%- assign params = include -%}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cengique, I can not understand why you assign this params variable but never use it.

{%- assign paginator = include.paginator -%}
{%- elsif layout.paginator -%}
{%- assign paginator = layout.paginator -%}
{%- elsif page.paginator -%}
{%- assign paginator = page.paginator -%}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we are using the page.paginator, it is from jekyll-paginate, the paginator has no the size attribute, it will cause the corruption.

@jeffreytse jeffreytse force-pushed the master branch 2 times, most recently from e871820 to d5af3e1 Compare June 18, 2021 11:32
@jeffreytse jeffreytse force-pushed the master branch 2 times, most recently from 3001c74 to 826e97f Compare June 30, 2021 03:46
@jeffreytse jeffreytse force-pushed the master branch 2 times, most recently from c9de297 to 9ecb45b Compare August 17, 2021 11:21
@jeffreytse jeffreytse force-pushed the master branch 3 times, most recently from bd29ba6 to df61d0c Compare February 12, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants