Can I change the sorting order for .PrevInSection/.NextInSection from default date to File.TranslationBaseName

In a section I have sorted my content by filename like this:

├── 1-einfuehrung-01-vorwort.md
├── 1-einfuehrung-02-einfuehrung.md
├── 2-ordner-dateien-01-datei-ordner-befehle.md
├── 2-ordner-dateien-02-dateien-oeffnen.md

Now I would like to add next previous links to each page. If I add this

{{ with .NextInSection }}
  <a href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }}

{{ with .PrevInSection }}
  <a href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }}

Links are added but sorted by default https://gohugo.io/templates/lists#order-content in this order:

Default: Weight > Date > LinkTitle > FilePath

My question: Is it possible to change the order to File.TranslationBaseName as I did with this range-loop? If yes, how :thinking:

 {{ range sort .Pages "File.TranslationBaseName" }}
  <a href="{{.Permalink}}">{{ .Title }}</a>
{{ end }}
1 Like