List sections ordered alphanumerical

My content is organized like this:

1960/ 1960/ 1960/ 1961/ 1961/

So my sections could be ordered alphanumerical on the frontpage like a simple table of contents.

The resulting list should read like this:

  • 1960
    • Index
    • Foo
    • Bar
  • 1961
    • Index
    • Baz

I browsed the documentation but found no hint, how to do this.

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.

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.