Skip to content
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

Prevent empty heaver toggler #3

Merged
merged 1 commit into from
May 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
{{ .Site.Title }}
</a>
</div>
<button class="navbar-toggler navbar-toggler-right collapsed" type="button" data-toggle="collapse" data-target="#navbarMainCollapse" aria-controls="navbarMainCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- only add the navbar toggle button if there are elements within the toggle -->
{{- if .Site.Menus.shortcuts}}
<button class="navbar-toggler navbar-toggler-right collapsed" type="button" data-toggle="collapse" data-target="#navbarMainCollapse" aria-controls="navbarMainCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarMainCollapse">
<ul class="navbar-nav ml-auto">
{{- with .Site.Menus.shortcuts}}
{{- range sort . "Weight"}}
<li class="nav-item">
<a class="nav-link" href="{{.URL}}" {{if eq $.Site.Params.menushortcutsnewtab true}}target="_blank"{{end}}>
{{safeHTML .Name}}
</a>
</li>
{{- end}}
{{- end}}
</ul>
</div>
<div class="collapse navbar-collapse" id="navbarMainCollapse">
<ul class="navbar-nav ml-auto">
{{- with .Site.Menus.shortcuts}}
{{- range sort . "Weight"}}
<li class="nav-item">
<a class="nav-link" href="{{.URL}}" {{if eq $.Site.Params.menushortcutsnewtab true}}target="_blank"{{end}}>
{{safeHTML .Name}}
</a>
</li>
{{- end}}
{{- end}}
</ul>
</div>
{{ - end}}
</div>
</nav>