Clarify pageRef menu property (#2059)

This commit is contained in:
Joe Mooring 2023-04-15 14:28:54 -07:00 committed by GitHub
parent a557b0ebf4
commit 5d392c3d45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 12 deletions

View File

@ -148,23 +148,31 @@ This creates a menu structure that you can access with `site.Menus.footer` in yo
### Properties {#properties-site-configuration} ### Properties {#properties-site-configuration}
{{% note %}}
The [properties available to entries defined in front matter] are also available to entries defined in site configuration.
[properties available to entries defined in front matter]: /content-management/menus/#properties-front-matter
{{% /note %}}
Each menu entry defined in site configuration requires two or more properties: Each menu entry defined in site configuration requires two or more properties:
- Specify `name` and `pageRef` for internal links - Specify `name` and `pageRef` for internal links
- Specify `name` and `url` for external links - Specify `name` and `url` for external links
pageRef pageRef
: (`string`) The file path of the target page, relative to the `content` directory. Required for *internal* links. : (`string`) The file path of the target page, relative to the `content` directory. Omit language code and file extension. Required for *internal* links.
Kind|pageRef
:--|:--
home|`/`
page|`/books/book-1`
section|`/books`
taxonomy|`/tags`
term|`/tags/foo`
url url
: (`string`) Required for *external* links. : (`string`) Required for *external* links.
{{% note %}}
The [properties] available to entries defined in front matter are also available to entries defined in site configuration.
[properties]: /content-management/menus/#properties-front-matter
{{% /note %}}
### Example {#example-site-configuration} ### Example {#example-site-configuration}
This nested menu demonstrates some of the available properties: This nested menu demonstrates some of the available properties:
@ -211,7 +219,7 @@ Hugo provides two methods to localize your menu entries. See [multilingual].
See [menu templates]. See [menu templates].
[Localize]: /content-management/multilingual/#menus [localize]: /content-management/multilingual/#menus
[menu templates]: /templates/menu-templates/ [menu templates]: /templates/menu-templates/
[multilingual]: /content-management/multilingual/#menus [multilingual]: /content-management/multilingual/#menus
[template]: /templates/menu-templates/ [template]: /templates/menu-templates/

View File

@ -120,7 +120,7 @@ Hugo provides two methods to localize your menu entries. See [multilingual].
[in front matter]: /content-management/menus/#define-in-front-matter [in front matter]: /content-management/menus/#define-in-front-matter
[in site configuration]: /content-management/menus/#define-in-site-configuration [in site configuration]: /content-management/menus/#define-in-site-configuration
[localize the menu entries]: /content-management/multilingual/#menus [localize the menu entries]: /content-management/multilingual/#menus
[Menu entry defined in front matter]: /content-management/menus/#example-front-matter [menu entry defined in front matter]: /content-management/menus/#example-front-matter
[Menu entry defined in site configuration]: /content-management/menus/#example-site-configuration [menu entry defined in site configuration]: /content-management/menus/#example-site-configuration
[menu variables and methods]: /variables/menus/ [menu variables and methods]: /variables/menus/
[multilingual]: /content-management/multilingual/#menus [multilingual]: /content-management/multilingual/#menus

View File

@ -13,7 +13,7 @@ aliases: [/variables/menu/]
## Variables ## Variables
After [defining the menu entries], access their properties with these variables. After [defining menu entries], access their properties in [menu templates] with these variables.
.Children .Children
: (`menu`) A collection of child menu entries, if any, under the current menu entry. : (`menu`) A collection of child menu entries, if any, under the current menu entry.
@ -86,6 +86,7 @@ After [defining the menu entries], access their properties with these variables.
: (`bool`) Use this method to determine the active menu entry. See [details](/functions/ismenucurrent/). : (`bool`) Use this method to determine the active menu entry. See [details](/functions/ismenucurrent/).
[automatically]: /content-management/menus/#define-automatically [automatically]: /content-management/menus/#define-automatically
[defining the menu entries]: /content-management/menus/#overview [defining menu entries]: /content-management/menus/#overview
[in front matter]: /content-management/menus/#define-in-front-matter [in front matter]: /content-management/menus/#define-in-front-matter
[in site configuration]: /content-management/menus/#define-in-site-configuration [in site configuration]: /content-management/menus/#define-in-site-configuration
[menu templates]: /templates/menu-templates/