Debian Codegraph @

docs/content/en/methods/menu-entry/Name.md

raw
1 ---
2 title: Name
3 description: Returns the `name` property of the given menu entry.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: string
9 signatures: [MENUENTRY.Name]
10 ---
11
12 If you define the menu entry [automatically][], the `Name` method returns the page's [`LinkTitle`][], falling back to its [`Title`][].
13
14 If you define the menu entry in [front matter][] or in your [project configuration][], the `Name` method returns the `name` property of the given menu entry. If the `name` is not defined, and the menu entry resolves to a page, the `Name` returns the page [`LinkTitle`][], falling back to its [`Title`][].
15
16 ```go-html-template
17 <ul>
18 {{ range .Site.Menus.main }}
19 <li><a href="{{ .URL }}">{{ .Name }}</a></li>
20 {{ end }}
21 </ul>
22 ```
23
24 [`LinkTitle`]: /methods/page/linktitle/
25 [`Title`]: /methods/page/title/
26 [automatically]: /content-management/menus/#define-automatically
27 [front matter]: /content-management/menus/#define-in-front-matter
28 [project configuration]: /content-management/menus/#define-in-project-configuration