-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Add functions to partition (page) slices #12830
Comments
Please provide an example of how you would use the new template function in a template (e.g., /layouts/_default/list.html). |
Thanks for this; this needs to put on hold for a little. I need to think a little about the "future" of the https://pkg.go.dev/github.com/bep/[email protected]/slicehelpers |
I made a minimal example which can be found here An envisioned use case might look like:
where the The minimal example here will look like: |
I'd be fine with skipping the collections part (i.e. |
I guess we can? I'd try to implement this once we decide to use that dependency. |
I propose to add some new functionality to split a slice of pages into chunks of a given fixed length plus possibly a shorter remainder.
Use cases include listings and multi-column row-based tabular layouts.
As far as I know there is right now no such functionality exposed to the templates API. The new functions should be straight-forward to use compared to a custom implementation by lower-level template primitives. It is expected to be faster and less error-prone too and, as a built-in readily available to all Hugo users.
This topic came up first with the bug report #11553 and it solves the issue raised there.
That bug is related to #11131 which broke a custom template-based implementation.
An implementation can be found at PR #12661 (resp. the branch https://github.com/raoulb/hugo/tree/partition).
With this post I'd like to start the discussion on what needs to be changed to get this functionality merged.
The text was updated successfully, but these errors were encountered: