diff options
Diffstat (limited to 'docs/content/en/methods/menu-entry/_common/pre-post.md')
-rw-r--r-- | docs/content/en/methods/menu-entry/_common/pre-post.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/docs/content/en/methods/menu-entry/_common/pre-post.md b/docs/content/en/methods/menu-entry/_common/pre-post.md new file mode 100644 index 000000000..8cc787ea9 --- /dev/null +++ b/docs/content/en/methods/menu-entry/_common/pre-post.md @@ -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/ |