I’m trying to group these Reports by the country listed alphabetically, and then display the two different reports in order by year.
Here’s the file structure:
Reports
-
argentina
– 2020
— index.md
– 2016
— index.md -
brazil
– 2020
—index.md
– 2016
— index.md
I want the display to be, in alpha order:
Argentina
2020 report
2016 report
Brazil
2020 report
2016 report
I have tried:
{{ range (where .Site.Pages.ByTitle "Section" "reports") }}
<h2 id="{{ .Params.Slug }}">{{ .Params.Name }}</h2>
<h3><a href="{{.Permalink }}">{{ .Params.Title }}</a></h3>
<p>{{ .Params.Intro }}<p>
{{ end }}
But the results are:
Argentina
2016
Brazil
2016
Report 2020 (Argentina)
Report 2020 (Brazil)
I have also tried:
{{ range .Pages.GroupBy "Section" }}
… etc
and
{{ range where .Pages ".Params.country" .Params.country }}
and
{{ range .Sections }}
{{ .Title }}
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
{{ end }}
Thanks for your help!