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

Index variables don‘t exist despite enabled pagination #310

Closed
nerdcoding opened this Issue Oct 20, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@nerdcoding

Problem

I used the latest JBake 2.5.0 release, enabled paging and set the post per page parameter:

index.paginate=true
index.posts_per_page=10

However in my freemarker template the variables nextFileName and previousFileName does not exist:

<#if (nextFileName)??> <#-- is always false -->
   [...]
</#if>
<#if (previousFileName)??> <#-- is always false -->
   [...]
</#if>

Possible solution

In org.jbake.app.Renderer#renderIndex() the variables are put to the model map:

[…]
model.put("previousFileName" …);
[…]
model.put("nextFileName",  …);
[…]

But the model is never given to freemarkers template engine. Maybe here the ModelRenderingConfig is needed instead of the used DefaultRenderingConfig.

@SergeyPirogov

This comment has been minimized.

Show comment
Hide comment
@SergeyPirogov

SergeyPirogov Oct 27, 2016

Have the same issue

Have the same issue

ancho added a commit to ancho/jbake that referenced this issue Oct 28, 2016

fixes #310 - propagate nextFileName and previousFileName to the model
* adds `currentPageNumber` to the model
* adds `numberOfPages` to the model
@jonbullock

This comment has been minimized.

Show comment
Hide comment
@jonbullock

jonbullock Nov 12, 2016

Member

Thanks for taking the time to raise an issue about this.

Member

jonbullock commented Nov 12, 2016

Thanks for taking the time to raise an issue about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment