Hello,
Hugo has a menu.html
partial when I create a new theme, which shows the menus like this:
partials/menu.html
{{- with index site.Menus $menuID }}
<nav class="main-navigation">
<button class="menu-toggle"><span>Toggle Menu</span></button>
<div class="menu-container">
<ul class="menu">
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
</div>
</nav>
{{- end }}
Then, to display the menu, I include it in the header of my website:
{{ partial "menu.html" (dict "menuID" "main" "page" .) }}
This of course displays the menu items configured in hugo.toml
. I looked at the Hugo documentation and found the rel="external"
option, but I’m not sure if it’s the right one to use for opening links in a new tab. After trying it, I still don’t see rel="external"
or target="_blank"
on the menu items.
[languages]
# English
# --------------------------------------------------------------------------
[languages.en]
weight = 1
languageCode = "en-US"
languageName = "English"
# Menu
[[languages.en.menu.main]]
name = "Home"
url = "/"
weight = 1
[[languages.en.menu.main]]
name = "About"
url = "/about/"
weight = 2
[[languages.en.menu.main]]
name = "External Link"
url = "https://website.com"
weight = 3
[languages.en.menu.main.params]
rel = 'external'
I would appreciate any suggestions.