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

Document "group" (new template func) (Hugo 0.49) #597

Closed
bep opened this issue Sep 8, 2018 · 2 comments
Closed

Document "group" (new template func) (Hugo 0.49) #597

bep opened this issue Sep 8, 2018 · 2 comments

Comments

@bep
Copy link
Member

bep commented Sep 8, 2018

gohugoio/hugo@6667c6d

@kaushalmodi
Copy link
Contributor

kaushalmodi commented Sep 9, 2018

In the example:

{{ $cool := where .Site.RegularPages "Params.cool" true | group "cool" }}
{{ $blue := where .Site.RegularPages "Params.blue" true | group "blue" }}
{{ $paginator := .Paginate (slice $cool $blue) }}
  • What's the relation between the "cool" argument of group and the $cool variable.

    I mean.. what would happen if you swapped the "cool" and "blue" arguments?

    {{ $cool := where .Site.RegularPages "Params.cool" true | group "blue" }}
    {{ $blue := where .Site.RegularPages "Params.blue" true | group "cool" }}
    
  • What does that group argument mean?


As an aside, it would be nice to make it a norm to include docs as parts of commits in Hugo core; else these issues will just keep on amounting.

Even adding docs in draft state would be nice. It will be then easier for non-Go contributors to brush up that doc draft.

@bep
Copy link
Member Author

bep commented Sep 9, 2018

As an aside, it would be nice to make it a norm to include docs as parts of commits in Hugo core;

It's not that simple. In this case we take at least 2 iterations to get the API right. Documenting every step creates additional work.

As to the "what". This is a "manual" way to create page groups that work like these:

https://gohugo.io/templates/lists#group-content

blue and cool in examples above will be the Key in the page group.

bep added a commit that referenced this issue Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants