You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 25, 2020. It is now read-only.
I have some problems when using post's frontmatter and paginating. Additional properties I define in the a post's frontmatter are not available when I use pagination.
---
layout: default
paginate: 1
title: 'A different title'
---
{% for post in paginator.posts %}
{{ post.title }}-{{ post.customfield }}
{% endfor %}
Then the first page is rendered with
Some post-
but I expect
Some post-bar
I'm always confused by Pretzel's code: on the one hand PageContext has several properties, and on the other hand it has a Bag, where some of the properties are duplicated.
This PR contains "only" a unit test to reproduce the issue. I don't know how to fix it at the moment.
Thanks a lot for the reporting 😃
I know that the paginator is kind of "weird" at best, but I hadn't take the time to investigate it.
Seems the time has come!
So finally it is not linked to the paginatordirectly but by the way we populate the liquid's template data in LiquidEngine: the paginator is passed directly without processing the data of each of his posts.
So right now the customfield is accessible through post.bag["customfield"].
An evolution could be to pass the paginator in LiquidEngine.CreatePageData but to call a ToHash method, like the one used on ContextDrop, which will return a Hash of all properties of paginator and call ToHash on each Page.
About PageContext, I think it is because Razor is also supported: it doesn't use page.customfield but @Model.Bag["customfield"] to access to custom values in page. So the properties are needed to facilitate the access to usual values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have some problems when using post's frontmatter and paginating. Additional properties I define in the a post's frontmatter are not available when I use pagination.
E.g. I have this post:
And my index.html look like this
Then the first page is rendered with
but I expect
I'm always confused by Pretzel's code: on the one hand
PageContexthas several properties, and on the other hand it has aBag, where some of the properties are duplicated.This PR contains "only" a unit test to reproduce the issue. I don't know how to fix it at the moment.