| 1 |
--- |
| 2 |
title: Menu |
| 3 |
description: Returns the identifier of the menu that contains the given menu entry. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: string |
| 9 |
signatures: [MENUENTRY.Menu] |
| 10 |
--- |
| 11 |
|
| 12 |
```go-html-template |
| 13 |
{{ range .Site.Menus.main }} |
| 14 |
{{ .Menu }} → main |
| 15 |
{{ end }} |
| 16 |
``` |
| 17 |
|
| 18 |
Use this method with the [`IsMenuCurrent`][] and [`HasMenuCurrent`][] methods on a `Page` object to set "active" and "ancestor" classes on a rendered entry. See [this example][]. |
| 19 |
|
| 20 |
[`HasMenuCurrent`]: /methods/page/hasmenucurrent/ |
| 21 |
[`IsMenuCurrent`]: /methods/page/ismenucurrent/ |
| 22 |
[this example]: /templates/menu/#example |