diff --git a/content/en/content-management/menus.md b/content/en/content-management/menus.md index e2a72f124..1f5d1ef71 100644 --- a/content/en/content-management/menus.md +++ b/content/en/content-management/menus.md @@ -48,7 +48,7 @@ To add a page to the "main" menu: {{< code-toggle file=content/about.md fm=true >}} title = 'About' -menu = 'main' +menus = 'main' {{< /code-toggle >}} Access the entry with `site.Menus.main` in your templates. See [menu templates] for details. @@ -57,11 +57,15 @@ To add a page to the "main" and "footer" menus: {{< code-toggle file=content/contact.md fm=true >}} title = 'Contact' -menu = ['main','footer'] +menus = ['main','footer'] {{< /code-toggle >}} Access the entry with `site.Menus.main` and `site.Menus.footer` in your templates. See [menu templates] for details. +{{% note %}} +The configuration key in the examples above is `menus`. The `menu` (singular) configuration key is an alias for `menus`. +{{% /note %}} + ### Properties {#properties-front-matter} Use these properties when defining menu entries in front matter: @@ -96,11 +100,11 @@ This front matter menu entry demonstrates some of the available properties: {{< code-toggle file=content/products/software.md fm=true >}} title = 'Software' -[menu.main] +[[menus.main]] parent = 'Products' weight = 20 pre = '' -[menu.main.params] +[menus.main.params] class = 'center' {{< /code-toggle >}} @@ -111,17 +115,17 @@ Access the entry with `site.Menus.main` in your templates. See [menu templates] To define entries for the "main" menu: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'Home' pageRef = '/' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Products' pageRef = '/products' weight = 20 -[[menu.main]] +[[menus.main]] name = 'Services' pageRef = '/services' weight = 30 @@ -132,12 +136,12 @@ This creates a menu structure that you can access with `site.Menus.main` in your To define entries for the "footer" menu: {{< code-toggle file=hugo >}} -[[menu.footer]] +[[menus.footer]] name = 'Terms' pageRef = '/terms' weight = 10 -[[menu.footer]] +[[menus.footer]] name = 'Privacy' pageRef = '/privacy' weight = 20 @@ -145,6 +149,10 @@ weight = 20 This creates a menu structure that you can access with `site.Menus.footer` in your templates. See [menu templates] for details. +{{% note %}} +The configuration key in the examples above is `menus`. The `menu` (singular) configuration key is an alias for `menus`. +{{% /note %}} + ### Properties {#properties-site-configuration} {{% note %}} @@ -177,34 +185,34 @@ url This nested menu demonstrates some of the available properties: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'Products' pageRef = '/products' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Hardware' pageRef = '/products/hardware' parent = 'Products' weight = 1 -[[menu.main]] +[[menus.main]] name = 'Software' pageRef = '/products/software' parent = 'Products' weight = 2 -[[menu.main]] +[[menus.main]] name = 'Services' pageRef = '/services' weight = 20 -[[menu.main]] +[[menus.main]] name = 'Hugo' pre = '' url = 'https://gohugo.io/' weight = 30 -[menu.main.params] +[menus.main.params] rel = 'external' {{< /code-toggle >}} diff --git a/content/en/content-management/multilingual.md b/content/en/content-management/multilingual.md index 112ceac1a..ea9f71787 100644 --- a/content/en/content-management/multilingual.md +++ b/content/en/content-management/multilingual.md @@ -546,12 +546,12 @@ languageCode = 'de-DE' languageName = 'Deutsch' weight = 1 -[[languages.de.menu.main]] +[[languages.de.menus.main]] name = 'Produkte' pageRef = '/products' weight = 10 -[[languages.de.menu.main]] +[[languages.de.menus.main]] name = 'Leistungen' pageRef = '/services' weight = 20 @@ -561,12 +561,12 @@ languageCode = 'en-US' languageName = 'English' weight = 2 -[[languages.en.menu.main]] +[[languages.en.menus.main]] name = 'Products' pageRef = '/products' weight = 10 -[[languages.en.menu.main]] +[[languages.en.menus.main]] name = 'Services' pageRef = '/services' weight = 20 @@ -579,13 +579,12 @@ With a more complex menu structure, create a [configuration directory] and split ```text config/ └── _default/ - ├── menus/ - │ ├── menu.de.toml - │ └── menu.en.toml + ├── menus.de.toml + ├── menus.en.toml └── hugo.toml ``` -{{< code-toggle file=config/_default/menus/menu.de >}} +{{< code-toggle file=config/_default/menus.de >}} [[main]] name = 'Produkte' pageRef = '/products' @@ -596,7 +595,7 @@ pageRef = '/services' weight = 20 {{< /code-toggle >}} -{{< code-toggle file=config/_default/menus/menu.en >}} +{{< code-toggle file=config/_default/menus.en >}} [[main]] name = 'Products' pageRef = '/products' @@ -627,12 +626,12 @@ The `identifier` depends on how you define menu entries: For example, if you define menu entries in site configuration: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] identifier = 'products' name = 'Products' pageRef = '/products' weight = 10 -[[menu.main]] +[[menus.main]] identifier = 'services' name = 'Services' pageRef = '/services' diff --git a/content/en/functions/safe/HTMLAttr.md b/content/en/functions/safe/HTMLAttr.md index 6e1fd2af7..198fc8ff3 100644 --- a/content/en/functions/safe/HTMLAttr.md +++ b/content/en/functions/safe/HTMLAttr.md @@ -19,7 +19,7 @@ aliases: [/functions/safehtmlattr] Given a site configuration that contains this menu entry: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = "IRC" url = "irc://irc.freenode.net/#golang" {{< /code-toggle >}} diff --git a/content/en/functions/safe/URL.md b/content/en/functions/safe/URL.md index 2ae67bd7f..2da6895e5 100644 --- a/content/en/functions/safe/URL.md +++ b/content/en/functions/safe/URL.md @@ -23,7 +23,7 @@ Without `safeURL`, only the URI schemes `http:`, `https:` and `mailto:` are cons The following examples use a [site `hugo.toml`][configuration] with the following [menu entry][menus]: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = "IRC: #golang at freenode" url = "irc://irc.freenode.net/#golang" {{< /code-toggle >}} diff --git a/content/en/methods/menu-entry/Children.md b/content/en/methods/menu-entry/Children.md index af2af6dce..ad671b2d0 100644 --- a/content/en/methods/menu-entry/Children.md +++ b/content/en/methods/menu-entry/Children.md @@ -15,18 +15,18 @@ Use the `Children` method when rendering a nested menu. With this site configuration: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'Products' pageRef = '/product' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Product 1' pageRef = '/products/product-1' parent = 'Products' weight = 1 -[[menu.main]] +[[menus.main]] name = 'Product 2' pageRef = '/products/product-2' parent = 'Products' diff --git a/content/en/methods/menu-entry/HasChildren.md b/content/en/methods/menu-entry/HasChildren.md index d906987e8..fac03b7ae 100644 --- a/content/en/methods/menu-entry/HasChildren.md +++ b/content/en/methods/menu-entry/HasChildren.md @@ -15,18 +15,18 @@ Use the `HasChildren` method when rendering a nested menu. With this site configuration: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'Products' pageRef = '/product' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Product 1' pageRef = '/products/product-1' parent = 'Products' weight = 1 -[[menu.main]] +[[menus.main]] name = 'Product 2' pageRef = '/products/product-2' parent = 'Products' diff --git a/content/en/methods/menu-entry/Identifier.md b/content/en/methods/menu-entry/Identifier.md index a4d7e129e..ba8b77ece 100644 --- a/content/en/methods/menu-entry/Identifier.md +++ b/content/en/methods/menu-entry/Identifier.md @@ -14,13 +14,13 @@ The `Identifier` method returns the `identifier` property of the menu entry. If [automatically]: /content-management/menus/#define-automatically {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] identifier = 'about' name = 'About' pageRef = '/about' weight = 10 -[[menu.main]] +[[menus.main]] identifier = 'contact' name = 'Contact' pageRef = '/contact' diff --git a/content/en/methods/menu-entry/KeyName.md b/content/en/methods/menu-entry/KeyName.md index 8031441b9..4b43596b0 100644 --- a/content/en/methods/menu-entry/KeyName.md +++ b/content/en/methods/menu-entry/KeyName.md @@ -12,13 +12,13 @@ action: In this menu definition, the second entry does not contain an `identifier`, so the `Identifier` method returns its `name` property instead: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] identifier = 'about' name = 'About' pageRef = '/about' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Contact' pageRef = '/contact' weight = 20 diff --git a/content/en/methods/menu-entry/Page.md b/content/en/methods/menu-entry/Page.md index 9b23f7b73..b76aa2c6f 100644 --- a/content/en/methods/menu-entry/Page.md +++ b/content/en/methods/menu-entry/Page.md @@ -14,15 +14,15 @@ Regardless of how you [define menu entries], an entry associated with a page has In this menu definition, the first two entries are associated with a page, the last entry is not: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] pageRef = '/about' weight = 10 -[[menu.main]] +[[menus.main]] pageRef = '/contact' weight = 20 -[[menu.main]] +[[menus.main]] name = 'Hugo' url = 'https://gohugo.io' weight = 30 diff --git a/content/en/methods/menu-entry/Params.md b/content/en/methods/menu-entry/Params.md index 1486c12cb..8af3f0637 100644 --- a/content/en/methods/menu-entry/Params.md +++ b/content/en/methods/menu-entry/Params.md @@ -12,21 +12,21 @@ action: When you define menu entries [in site configuration] or [in front matter], you can include a `params` key to attach additional information to the entry. For example: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'About' pageRef = '/about' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Contact' pageRef = '/contact' weight = 20 -[[menu.main]] +[[menus.main]] name = 'Hugo' url = 'https://gohugo.io' weight = 30 -[menu.main.params] +[menus.main.params] rel = 'external' {{< /code-toggle >}} diff --git a/content/en/methods/menu-entry/Parent.md b/content/en/methods/menu-entry/Parent.md index 897712831..af1b4afe6 100644 --- a/content/en/methods/menu-entry/Parent.md +++ b/content/en/methods/menu-entry/Parent.md @@ -12,19 +12,18 @@ action: With this menu definition: {{< code-toggle file=hugo >}} -[menu] -[[menu.main]] +[[menus.main]] name = 'Products' pageRef = '/product' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Product 1' pageRef = '/products/product-1' parent = 'Products' weight = 1 -[[menu.main]] +[[menus.main]] name = 'Product 2' pageRef = '/products/product-2' parent = 'Products' diff --git a/content/en/methods/menu-entry/_common/pre-post.md b/content/en/methods/menu-entry/_common/pre-post.md index 8cc787ea9..fbfce062a 100644 --- a/content/en/methods/menu-entry/_common/pre-post.md +++ b/content/en/methods/menu-entry/_common/pre-post.md @@ -7,14 +7,14 @@ In this site configuration we enable rendering of [emoji shortcodes], and add em {{< code-toggle file=hugo >}} enableEmoji = true -[[menu.main]] +[[menus.main]] name = 'About' pageRef = '/about' post = ':point_left:' pre = ':point_right:' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Contact' pageRef = '/contact' post = ':arrow_left:' diff --git a/content/en/methods/menu/ByName.md b/content/en/methods/menu/ByName.md index 3f1c52b2e..04f25c22d 100644 --- a/content/en/methods/menu/ByName.md +++ b/content/en/methods/menu/ByName.md @@ -14,17 +14,17 @@ The `Sort` method returns the given menu with its entries sorted by `name`. Consider this menu definition: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'Services' pageRef = '/services' weight = 10 -[[menu.main]] +[[menus.main]] name = 'About' pageRef = '/about' weight = 20 -[[menu.main]] +[[menus.main]] name = 'Contact' pageRef = '/contact' weight = 30 diff --git a/content/en/methods/menu/ByWeight.md b/content/en/methods/menu/ByWeight.md index c915914db..d5cb0444b 100644 --- a/content/en/methods/menu/ByWeight.md +++ b/content/en/methods/menu/ByWeight.md @@ -16,19 +16,19 @@ The `ByWeight` method returns the given menu with its entries sorted by [`weight Consider this menu definition: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] identifier = 'about' name = 'About' pageRef = '/about' weight = 20 -[[menu.main]] +[[menus.main]] identifier = 'services' name = 'Services' pageRef = '/services' weight = 10 -[[menu.main]] +[[menus.main]] identifier = 'contact' name = 'Contact' pageRef = '/contact' diff --git a/content/en/methods/menu/Limit.md b/content/en/methods/menu/Limit.md index 12263e811..23a523dbd 100644 --- a/content/en/methods/menu/Limit.md +++ b/content/en/methods/menu/Limit.md @@ -14,17 +14,17 @@ The `Limit` method returns the given menu, limited to the first N entries. Consider this menu definition: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'Services' pageRef = '/services' weight = 10 -[[menu.main]] +[[menus.main]] name = 'About' pageRef = '/about' weight = 20 -[[menu.main]] +[[menus.main]] name = 'Contact' pageRef = '/contact' weight = 30 diff --git a/content/en/methods/menu/Reverse.md b/content/en/methods/menu/Reverse.md index 989132d60..a3fe09dce 100644 --- a/content/en/methods/menu/Reverse.md +++ b/content/en/methods/menu/Reverse.md @@ -14,17 +14,17 @@ The `Reverse` method returns the given menu, reversing the sort order of its ent Consider this menu definition: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'Services' pageRef = '/services' weight = 10 -[[menu.main]] +[[menus.main]] name = 'About' pageRef = '/about' weight = 20 -[[menu.main]] +[[menus.main]] name = 'Contact' pageRef = '/contact' weight = 30 diff --git a/content/en/methods/site/Menus.md b/content/en/methods/site/Menus.md index 1967a9211..c204fe97b 100644 --- a/content/en/methods/site/Menus.md +++ b/content/en/methods/site/Menus.md @@ -22,27 +22,27 @@ Menus can be defined and localized in several ways. Please see the [menus] secti A site can have multiple menus. For example, a main menu and a footer menu: {{< code-toggle file=hugo >}} -[[menu.main]] +[[menus.main]] name = 'Home' pageRef = '/' weight = 10 -[[menu.main]] +[[menus.main]] name = 'Books' pageRef = '/books' weight = 20 -[[menu.main]] +[[menus.main]] name = 'Films' pageRef = '/films' weight = 30 -[[menu.footer]] +[[menus.footer]] name = 'Legal' pageRef = '/legal' weight = 10 -[[menu.footer]] +[[menus.footer]] name = 'Privacy' pageRef = '/privacy' weight = 20