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

Add a pageGroup func (or similar) #4865

Closed
vdanjean opened this issue Jun 21, 2018 · 3 comments · Fixed by #5187
Closed

Add a pageGroup func (or similar) #4865

vdanjean opened this issue Jun 21, 2018 · 3 comments · Fixed by #5187

Comments

@vdanjean
Copy link
Contributor

As discussed in https://discourse.gohugo.io/t/paginate-from-slice-of-page/12524 , Paginate currently do not accept a (plain) slice of Page, nor a Dict to used as PagesGroup. it would be a useful extension when specific ordering or grouping have to be used in templates

@bep
Copy link
Member

bep commented Aug 15, 2018

See my comment and the rest of the discussion in #4866 (comment)

@bep bep changed the title Relaxing Paginate argument Add a pageGroup func (or similar) Aug 15, 2018
@bep bep modified the milestones: v0.48, v0.49 Aug 15, 2018
@vdanjean
Copy link
Contributor Author

I tried to implement in #5132 what have been proposed in #4866 comments. The API is indeed really easier to use.

bep pushed a commit that referenced this issue Sep 8, 2018
This also adjusts the pagination logic to allow for these new collections.

Note that we will follow up with a template function named `group` that will be the end user API. The `.Group` method on `Page` should be considered as internal.

Updates #4865
bep added a commit to bep/hugo that referenced this issue Sep 8, 2018
This extends the page grouping in Hugo with a template function that allows for ad-hoc grouping.

A made-up example:

```
{{ $cool := where .Site.RegularPages "Params.cool" true | group "cool" }}
{{ $blue := where .Site.RegularPages "Params.blue" true | group "blue" }}
{{ $paginator := .Paginate (slice $cool $blue) }}
```

Closes gohugoio#4865
bep added a commit to bep/hugo that referenced this issue Sep 8, 2018
This extends the page grouping in Hugo with a template function that allows for ad-hoc grouping.

A made-up example:

```
{{ $cool := where .Site.RegularPages "Params.cool" true | group "cool" }}
{{ $blue := where .Site.RegularPages "Params.blue" true | group "blue" }}
{{ $paginator := .Paginate (slice $cool $blue) }}
```

Closes gohugoio#4865
bep added a commit to bep/hugo that referenced this issue Sep 8, 2018
This extends the page grouping in Hugo with a template function that allows for ad-hoc grouping.

A made-up example:

```
{{ $cool := where .Site.RegularPages "Params.cool" true | group "cool" }}
{{ $blue := where .Site.RegularPages "Params.blue" true | group "blue" }}
{{ $paginator := .Paginate (slice $cool $blue) }}
```

Closes gohugoio#4865
@bep bep closed this as completed in #5187 Sep 8, 2018
bep added a commit that referenced this issue Sep 8, 2018
This extends the page grouping in Hugo with a template function that allows for ad-hoc grouping.

A made-up example:

```
{{ $cool := where .Site.RegularPages "Params.cool" true | group "cool" }}
{{ $blue := where .Site.RegularPages "Params.blue" true | group "blue" }}
{{ $paginator := .Paginate (slice $cool $blue) }}
```

Closes #4865
bep added a commit that referenced this issue Sep 8, 2018
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants