mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
39
docs/content/en/_common/menu-entries/pre-and-post.md
Normal file
39
docs/content/en/_common/menu-entries/pre-and-post.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
_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/
|
Reference in New Issue
Block a user