Enable main menu to be left aligned

This commit is contained in:
George Cushen 2017-11-16 21:53:45 +00:00
commit b6e1dd2710
2 changed files with 12 additions and 2 deletions

View file

@ -227,6 +227,9 @@ defaultContentLanguageInSubdir = false
# To link a homepage widget, specify the URL as a hash `#` followed by the filename of the
# desired widget in your `content/home/` folder.
# The weight parameter defines the order that the links will appear in.
[params.menus]
# Align the main menu to the right of the page? (true/false)
align_right = true
[[menu.main]]
name = "Home"

View file

@ -25,7 +25,8 @@
<div class="collapse navbar-collapse">
<!-- Left Nav Bar -->
<ul class="nav navbar-nav navbar-right">
{{ $align_right := .Site.Params.menus.align_right | default true }}
<ul class="nav navbar-nav {{ if $align_right }}navbar-right{{ else }}navbar-left{{ end }}">
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
@ -57,8 +58,14 @@
{{ end }}
{{ end }}
{{ if and .IsTranslated (not $align_right) }}
</ul>
{{ end }}
{{ if .IsTranslated }}
{{ if .IsTranslated }}
{{ if not $align_right }}
<ul class="nav navbar-nav navbar-right">
{{ end }}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true">
<i class="fa fa-globe" aria-hidden="true"></i>