-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does Hero support submenu in nav-bar? #15
Comments
Ended up building one, so it is possible! Closing out issue |
Im glad you got it done. If your repo is public can you share the link, this is quite a common request. |
Unfortunately the repo is private, however I can explain how I made it work. First off, I had to edit my config.toml. There is an "identifier" property you can throw in. Then for whatever you want inside the dropdown, you need to add the property called "parent", like so: `[[menu.main]] [[menu.main]] Then in the html there is an "HasChildren" and "{{range .Children}}" properties that will need to be added, like so:
That's how I was able to get it working. Cheers! |
@Bp3289 I tried adjusting the layouts/partials/main-menu.html but I am messing up somewhere. This is what I have: <div id="main-menu" class="main-menu">
<ul>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<div class="dropdown"> <button class="dropbtn">Resources <i class="fa fa-caret-down"></i> </button>
<div class="dropdown-content"> {{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</div>
</div>
</ul>
</div> But getting unexpected eof error... |
Hi,
I am currently using the hero theme for hugo. I've been trying to add a dropdown menu in the navbar. I've seen from other themes that they use a "submenu" and use the parent and children identifier in the config.toml. I've also seen some people suggest the reason submenu isn't working for them is because their theme doesn't support it. I can't find any documentation for the hero theme to tell if it supports submenu. I wanted to ask just in case it's not supported for hero theme.
Best,
William
The text was updated successfully, but these errors were encountered: