mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-26 22:04:32 +02:00
Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'
This commit is contained in:
13
docs/content/en/methods/menu-entry/_common/_index.md
Normal file
13
docs/content/en/methods/menu-entry/_common/_index.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
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.
|
||||
-->
|
39
docs/content/en/methods/menu-entry/_common/pre-post.md
Normal file
39
docs/content/en/methods/menu-entry/_common/pre-post.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
# 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
|
||||
|
||||
[[menu.main]]
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
post = ':point_left:'
|
||||
pre = ':point_right:'
|
||||
weight = 10
|
||||
|
||||
[[menu.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/
|
Reference in New Issue
Block a user