Skip to content

Conversation

@KStocky
Copy link
Contributor

@KStocky KStocky commented Apr 26, 2025

Currently, there is no way for authors to choose the order in which PAGE.PrevInSection and PAGE.NextInSection are ordered for navigation in the footer of a page.

This PR just changes the reversePagination input in layouts/partials/components/pager.html from being hardcoded to true, to being set from the page front matter like so:

---
params:
  reversePagination: false
---

This allows authors to disable this reverse authoring on a per page basis or use the cascade front matter to set it on entire page sections.

KStocky added 2 commits April 26, 2025 14:55
…m parameter along with an example of how to use it and why you might want to use it
@netlify
Copy link

netlify bot commented Apr 26, 2025

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit 01bd347
🔍 Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/680d08e7d280a40008c85d70
😎 Deploy Preview https://deploy-preview-674--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Owner

@imfing imfing left a comment

Choose a reason for hiding this comment

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

thank you, this looks good

@imfing imfing requested a review from Copilot May 23, 2025 00:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR makes pagination direction configurable per page by reading a reversePagination flag from front matter and adds docs to guide authors on its usage.

  • The blog single template now defaults reversePagination to the page’s param instead of always true.
  • Documentation in the example site was added to explain how to toggle pagination order via front matter.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
layouts/blog/single.html Use .Params.reversePagination with a default instead of hardcoded true
exampleSite/content/docs/guide/organize-files.md New section on section pagination order and front-matter configuration
Comments suppressed due to low confidence (1)

layouts/blog/single.html:43

  • Consider adding automated tests to verify that when reversePagination is set to true or false in front matter, the pager correctly flips navigation links.
{{- .Scratch.Set "reversePagination" (.Params.reversePagination | default true) -}}

Comment on lines +92 to +95
To disable this reversed ordering you can set the `reversePagination` custom parameter in the page front matter to `false`. By default `reversePagination` is set to `true`.

#### Example

Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

[nitpick] It may help to explicitly note that reversePagination must be placed under the params: section in your front matter (e.g., params:\n reversePagination: false).

Suggested change
To disable this reversed ordering you can set the `reversePagination` custom parameter in the page front matter to `false`. By default `reversePagination` is set to `true`.
#### Example
To disable this reversed ordering, you can set the `reversePagination` custom parameter in the page front matter to `false`. By default, `reversePagination` is set to `true`.
Note: The `reversePagination` parameter must be placed under the `params:` section in the front matter for it to work correctly.
#### Example
```yaml {filename="content/blog/_index.md"}
---
title: Blog
params:
reversePagination: false
---

Copilot uses AI. Check for mistakes.
@imfing imfing changed the title feat: Allow authors to set the value of reversePagination in page front matter feat: allow authors to set the value of reversePagination in page front matter May 23, 2025
@imfing imfing merged commit 72c383e into imfing:main May 23, 2025
4 checks passed
@KStocky KStocky deleted the PageControlledPaginationOrder branch August 30, 2025 15:12
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