mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-23 21:53:09 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -3,10 +3,10 @@ title: ByName
|
||||
description: Returns the given menu with its entries sorted by name.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENU.ByName]
|
||||
params:
|
||||
functions_and_methods:
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENU.ByName]
|
||||
---
|
||||
|
||||
The `Sort` method returns the given menu with its entries sorted by `name`.
|
||||
|
@@ -3,10 +3,10 @@ title: ByWeight
|
||||
description: Returns the given menu with its entries sorted by weight, then by name, then by identifier.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENU.ByWeight]
|
||||
params:
|
||||
functions_and_methods:
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENU.ByWeight]
|
||||
---
|
||||
|
||||
The `ByWeight` method returns the given menu with its entries sorted by [`weight`](g), then by `name`, then by `identifier`. This is the default sort order.
|
||||
@@ -53,11 +53,8 @@ Hugo renders this to:
|
||||
</ul>
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
In the menu definition above, note that the `identifier` property is only required when two or more menu entries have the same name, or when localizing the name using translation tables.
|
||||
|
||||
[details]: /content-management/menus/#properties-front-matter
|
||||
{{% /note %}}
|
||||
> [!note]
|
||||
> In the menu definition above, note that the `identifier` property is only required when two or more menu entries have the same name, or when localizing the name using translation tables.
|
||||
|
||||
You can also sort menu entries using the [`sort`] function. For example, to sort by `weight` in descending order:
|
||||
|
||||
|
@@ -3,10 +3,10 @@ title: Limit
|
||||
description: Returns the given menu, limited to the first N entries.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENU.Limit N]
|
||||
params:
|
||||
functions_and_methods:
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENU.Limit N]
|
||||
---
|
||||
|
||||
The `Limit` method returns the given menu, limited to the first N entries.
|
||||
|
@@ -3,10 +3,10 @@ title: Reverse
|
||||
description: Returns the given menu, reversing the sort order of its entries.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENU.Reverse]
|
||||
params:
|
||||
functions_and_methods:
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENU.Reverse]
|
||||
---
|
||||
|
||||
The `Reverse` method returns the given menu, reversing the sort order of its entries.
|
||||
|
@@ -4,9 +4,4 @@ linkTitle: Menu
|
||||
description: Use these methods when ranging through menu entries.
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: methods
|
||||
---
|
||||
|
||||
Use these methods when ranging through menu entries.
|
||||
|
Reference in New Issue
Block a user