mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-20 02:17:39 +00:00
content: Consolidate configuration documentation
This commit is contained in:
1 parent
727ef6f665
commit
b6cae5cbc6
911 files changed
+10902
-11171
No files matched your search
@@ -3,11 +3,12 @@ title: Children
|
||||
description: Returns a collection of child menu entries, if any, under the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/menu-entry/HasChildren
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENUENTRY.Children]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related:
|
||||
- methods/menu-entry/HasChildren
|
||||
returnType: navigation.Menu
|
||||
signatures: [MENUENTRY.Children]
|
||||
---
|
||||
|
||||
Use the `Children` method when rendering a nested menu.
|
||||
|
||||
@@ -3,11 +3,12 @@ title: HasChildren
|
||||
description: Reports whether the given menu entry has child menu entries.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/menu-entry/Children
|
||||
returnType: bool
|
||||
signatures: [MENUENTRY.HasChildren]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related:
|
||||
- methods/menu-entry/Children
|
||||
returnType: bool
|
||||
signatures: [MENUENTRY.HasChildren]
|
||||
---
|
||||
|
||||
Use the `HasChildren` method when rendering a nested menu.
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
---
|
||||
title: Identifier
|
||||
description: Returns the `identifier` property of the given menu entry.
|
||||
description: Returns the `identifier` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Identifier]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Identifier]
|
||||
---
|
||||
|
||||
The `Identifier` method returns the `identifier` property of the menu entry. If you define the menu entry [automatically], it returns the page's section.
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
---
|
||||
title: KeyName
|
||||
description: Returns the `identifier` property of the given menu entry, falling back to its `name` property.
|
||||
description: Returns the `identifier` property of the given menu entry, falling back to its `name` property.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.KeyName]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.KeyName]
|
||||
---
|
||||
|
||||
In this menu definition, the second entry does not contain an `identifier`, so the `Identifier` method returns its `name` property instead:
|
||||
|
||||
@@ -3,12 +3,13 @@ title: Menu
|
||||
description: Returns the identifier of the menu that contains the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/page/IsMenuCurrent
|
||||
- methods/page/HasMenuCurrent
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Menu]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related:
|
||||
- methods/page/IsMenuCurrent
|
||||
- methods/page/HasMenuCurrent
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Menu]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
|
||||
@@ -3,10 +3,11 @@ title: Name
|
||||
description: Returns the `name` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Name]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Name]
|
||||
---
|
||||
|
||||
If you define the menu entry [automatically], the `Name` method returns the page's [`LinkTitle`], falling back to its [`Title`].
|
||||
|
||||
@@ -3,10 +3,11 @@ title: Page
|
||||
description: Returns the Page object associated with the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: page.Page
|
||||
signatures: [MENUENTRY.Page]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: page.Page
|
||||
signatures: [MENUENTRY.Page]
|
||||
---
|
||||
|
||||
Regardless of how you [define menu entries], an entry associated with a page has access to its [methods].
|
||||
|
||||
@@ -3,12 +3,12 @@ title: PageRef
|
||||
description: Returns the `pageRef` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- /methods/menu-entry/URL
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.PageRef]
|
||||
toc: true
|
||||
params:
|
||||
functions_and_methods:
|
||||
related:
|
||||
- /methods/menu-entry/URL
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.PageRef]
|
||||
---
|
||||
|
||||
The use case for this method is rare.
|
||||
|
||||
@@ -3,10 +3,11 @@ title: Params
|
||||
description: Returns the `params` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: maps.Params
|
||||
signatures: [MENUENTRY.Params]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: maps.Params
|
||||
signatures: [MENUENTRY.Params]
|
||||
---
|
||||
|
||||
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:
|
||||
|
||||
@@ -3,10 +3,11 @@ title: Parent
|
||||
description: Returns the `parent` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Parent]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Parent]
|
||||
---
|
||||
|
||||
With this menu definition:
|
||||
@@ -40,7 +41,7 @@ This template renders the nested menu, listing the `parent` property next each o
|
||||
{{ if .HasChildren }}
|
||||
<ul>
|
||||
{{ range .Children }}
|
||||
<li><a href="{{ .URL }}">{{ .Name }}</a> ({{ .Parent }})</li>
|
||||
<li><a href="{{ .URL }}">{{ .Name }}</a> ({{ .Parent }})</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
---
|
||||
title: Post
|
||||
description: Returns the `post` property of the given menu entry.
|
||||
description: Returns the `post` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/menu-entry/Pre
|
||||
returnType: template.HTML
|
||||
signatures: [MENUENTRY.Post]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related:
|
||||
- methods/menu-entry/Pre
|
||||
returnType: template.HTML
|
||||
signatures: [MENUENTRY.Post]
|
||||
---
|
||||
|
||||
{{% include "methods/menu-entry/_common/pre-post.md" %}}
|
||||
{{% include "/_common/menu-entries/pre-and-post.md" %}}
|
||||
@@ -1,13 +1,14 @@
|
||||
---
|
||||
title: Pre
|
||||
description: Returns the `pre` property of the given menu entry.
|
||||
description: Returns the `pre` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/menu-entry/Post
|
||||
returnType: template.HTML
|
||||
signatures: [MENUENTRY.Pre]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related:
|
||||
- methods/menu-entry/Post
|
||||
returnType: template.HTML
|
||||
signatures: [MENUENTRY.Pre]
|
||||
---
|
||||
|
||||
{{% include "methods/menu-entry/_common/pre-post.md" %}}
|
||||
{{% include "/_common/menu-entries/pre-and-post.md" %}}
|
||||
@@ -1,15 +1,16 @@
|
||||
---
|
||||
title: Title
|
||||
description: Returns the `title` property of the given menu entry.
|
||||
description: Returns the `title` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Title]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.Title]
|
||||
---
|
||||
|
||||
The `Title` method returns the `title` property of the given menu entry. If the `title` is not defined, and the menu entry resolves to a page, the `Title` returns the page [`Title`].
|
||||
The `Title` method returns the `title` property of the given menu entry. If the `title` is not defined, and the menu entry resolves to a page, the `Title` returns the page [`Title`].
|
||||
|
||||
[`Title`]: /methods/page/title/
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ title: URL
|
||||
description: Returns the relative permalink of the page associated with the given menu entry, else its `url` property.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.URL]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [MENUENTRY.URL]
|
||||
---
|
||||
|
||||
For menu entries associated with a page, the `URL` method returns the page's [`RelPermalink`], otherwise it returns the entry's `url` property.
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
---
|
||||
title: Weight
|
||||
description: Returns the `weight` property of the given menu entry.
|
||||
description: Returns the `weight` property of the given menu entry.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: int
|
||||
signatures: [MENUENTRY.Weight]
|
||||
params:
|
||||
functions_and_methods:
|
||||
related: []
|
||||
returnType: int
|
||||
signatures: [MENUENTRY.Weight]
|
||||
---
|
||||
|
||||
If you define the menu entry [automatically], the `Weight` method returns the page’s [`Weight`].
|
||||
If you define the menu entry [automatically], the `Weight` method returns the page's [`Weight`].
|
||||
|
||||
If you define the menu entry [in front matter] or [in site configuration], the `Weight` method returns the `weight` property, falling back to the page’s `Weight`.
|
||||
If you define the menu entry [in front matter] or [in site configuration], the `Weight` method returns the `weight` property, falling back to the page's `Weight`.
|
||||
|
||||
[`Weight`]: /methods/page/weight/
|
||||
[automatically]: /content-management/menus/#define-automatically
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
cascade:
|
||||
_build:
|
||||
list: never
|
||||
publishResources: false
|
||||
render: never
|
||||
---
|
||||
|
||||
<!--
|
||||
Files within this headless branch bundle are Markdown snippets. Each file must contain front matter delimiters, though front matter fields are not required.
|
||||
|
||||
Include the rendered content using the "include" shortcode.
|
||||
-->
|
||||
@@ -1,39 +0,0 @@
|
||||
---
|
||||
_comment: Do not remove front matter.
|
||||
---
|
||||
|
||||
In this site configuration we enable rendering of [emoji shortcodes], and add emoji shortcodes before (pre) and after (post) each menu entry:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
enableEmoji = true
|
||||
|
||||
[[menus.main]]
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
post = ':point_left:'
|
||||
pre = ':point_right:'
|
||||
weight = 10
|
||||
|
||||
[[menus.main]]
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
post = ':arrow_left:'
|
||||
pre = ':arrow_right:'
|
||||
weight = 20
|
||||
{{< /code-toggle >}}
|
||||
|
||||
To render the menu:
|
||||
|
||||
```go-html-template
|
||||
<ul>
|
||||
{{ range .Site.Menus.main }}
|
||||
<li>
|
||||
{{ .Pre | markdownify }}
|
||||
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||
{{ .Post | markdownify }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
```
|
||||
|
||||
[emoji shortcodes]: /quick-reference/emojis/
|
||||
@@ -4,9 +4,4 @@ linkTitle: Menu entry
|
||||
description: Use these methods in your menu templates.
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: methods
|
||||
---
|
||||
|
||||
Use these methods in your menu templates.
|
||||
Reference in new issue
Block a user