Menu entry name also as name in list.html

Hello,

I’m currently trying to use the menu entry name that I set in my config.toml also for the header in my list.html.

Let’s say I have set name = “Posts”. That shows up as a menu entry name. But if I try to also use this name as the header in my list with {{ .Name }} is does not work.

How can I use the menu entry name also as the header for my list.html?

I don’t think this can be accomplished the way you want to. You could do the following though:

{{ range .Site.Menus.main }}
	{{ $i := . }}
	{{ with .Page }}
		{{ if eq .Permalink $.Permalink }}
			{{ $i.Name }}
		{{ end }}
	{{ end }}
{{ end }}

Thank you for the try, but this does not work. :frowning:

Instead of using the menu entry name. Is there maybe a possibility to remove the s from a {{ .Name }}?
For the German language this is very annoying.

Okay I found the solution by myself. There is a configuration option named: pluralizeListTitles. :slight_smile:

1 Like

Awesome, you can also use the singularize function: