juh2
August 10, 2016, 3:50pm
#1
My content is organized like this:
1960/index.md 1960/foo.md 1960/bar.md 1961/index.md 1961/baz.md
So my sections could be ordered alphanumerical on the frontpage like a simple table of contents.
The resulting list should read like this:
I browsed the documentation but found no hint, how to do this.
bep
August 10, 2016, 5:58pm
#2
Currently not supported … but, I assume 1960 etc. is a date. Put that date (or year) in a front matter param and then use GroupByParamDate with a year as dateformat.
juh2
August 11, 2016, 9:01am
#3
I thought about using a date in the frontmatter, but in the meantime I found this solution.
{{ range .Data.Pages.GroupBy "Section" }} <h2>{{ .Key }}</h2> <ul id="list"> {{ range .Pages }} {{ .Render "li"}} {{ end }} </ul> {{ end }}
It works for the frontpage. I am not sure whether it will work in other place were I need a ordering by section.