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

Fix list pagination #240

Closed
wants to merge 1 commit into from
Closed

Conversation

thewheat
Copy link

@thewheat thewheat commented Oct 2, 2022

Add pagination to pagelayout partial using pagination_data. Add pagination_data in list layout to allow list pagination

Fixes: gohugoio/hugoDocs#1547

Preview of change

image

Add pagination to pagelayout partial using pagination_data. Add
pagination_data list layout to allow list pagination

Fixes: gohugoio/hugoDocs#1547
@@ -27,6 +27,10 @@ <h1 class="primary-color-dark f2">
</section>
</div>

<div class="nested-list-reset nested-links">
{{/* pagination.html: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/template_embedded.go#L117 */}}
{{ template "_internal/pagination.html" .pagination_data }}
Copy link
Author

Choose a reason for hiding this comment

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

  • I initially tried using .context but it did not work with the following error

failed to render pages: render of "page" failed: execute of template failed at <partial "pagelayout.html" (dict "context" . "section_to_display" $section_to_display)>: error calling partial: execute of template failed at <$page.Paginator.TotalPages>: error calling TotalPages: runtime error: invalid memory address or nil pointer dereference

  • Am not too familiar with the inner workings thus added a separate key to the dict and it worked

So if there is a cleaner way do let me know and will be happy to change and confirm how it goes

@jmooring
Copy link
Member

jmooring commented Nov 6, 2023

Superseded by gohugoio/hugoDocs#2296

@jmooring jmooring closed this Nov 6, 2023
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.

Functions Quick Reference is truncated
2 participants