Skip to content

Commit

Permalink
Clarify pageRef menu property (#2059)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring committed Apr 15, 2023
1 parent a557b0e commit 5d392c3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
24 changes: 16 additions & 8 deletions content/en/content-management/menus.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,31 @@ This creates a menu structure that you can access with `site.Menus.footer` in yo

### 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:

- Specify `name` and `pageRef` for internal links
- Specify `name` and `url` for external links

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
: (`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}

This nested menu demonstrates some of the available properties:
Expand Down Expand Up @@ -211,7 +219,7 @@ Hugo provides two methods to localize your menu entries. See [multilingual].

See [menu templates].

[Localize]: /content-management/multilingual/#menus
[localize]: /content-management/multilingual/#menus
[menu templates]: /templates/menu-templates/
[multilingual]: /content-management/multilingual/#menus
[template]: /templates/menu-templates/
4 changes: 2 additions & 2 deletions content/en/templates/menu-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 site configuration]: /content-management/menus/#define-in-site-configuration
[localize the menu entries]: /content-management/multilingual/#menus
[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 front matter]: /content-management/menus/#example-front-matter
[menu entry defined in site configuration]: /content-management/menus/#example-site-configuration
[menu variables and methods]: /variables/menus/
[multilingual]: /content-management/multilingual/#menus
5 changes: 3 additions & 2 deletions content/en/variables/menus.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ aliases: [/variables/menu/]

## 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
: (`menu`) A collection of child menu entries, if any, under the current menu entry.
Expand Down Expand Up @@ -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/).

[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 site configuration]: /content-management/menus/#define-in-site-configuration
[menu templates]: /templates/menu-templates/

0 comments on commit 5d392c3

Please sign in to comment.