hugo/docs/content/en/methods/menu-entry/_common/pre-post.md
2023-12-04 15:24:01 +01:00

737 B

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 = '👈' pre = '👉' weight = 10

menu.main name = 'Contact' pageRef = '/contact' post = '⬅️' pre = '➡️' weight = 20 {{< /code-toggle >}}

To render the menu:

<ul>
  {{ range .Site.Menus.main }}
    <li>
      {{ .Pre | markdownify }}
      <a href="{{ .URL }}">{{ .Name }}</a>
      {{ .Post | markdownify }}
    </li>
  {{ end }}
</ul>