<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  <!-- Brand and toggle get grouped for better mobile display -->
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="/"><i class="icon-hugo_serif" alt="hugo"></i></a>
  </div>

  <!-- Collect the nav links, forms, and other content for toggling -->
  <div class="collapse navbar-collapse navbar-ex1-collapse">
    <ul class="nav navbar-nav">
      {{ $currentNode := . }}
      {{ range .Site.Menus.main }}
          {{ if .HasChildren }}
          <li class="dropdown{{if $currentNode.HasMenuCurrent "main" . }} active{{end}}">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{.Name}} <b class="caret"></b></a>
            <ul class="dropdown-menu">
            {{ range .Children }}
                <li{{if $currentNode.IsMenuCurrent "main" .Name}} class="active"{{end}}><a href="{{.Url}}"> {{ .Name }} </a> </li>
            {{ end }}
            </ul>
          {{else}}
            <li>
            <a href="{{.Url}}"> {{ .Name }} </a>
          {{end}}
          </li>
      {{end}}
    </ul>
    <ul class="nav navbar-nav navbar-right">
      {{ $currentNode := . }}
      {{ $menu := "right"}}
      {{ range .Site.Menus.right }}
          {{ if .HasChildren }}
          <li class="dropdown{{if $currentNode.HasMenuCurrent $menu . }} active-child{{end}}">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{.Name}} <b class="caret"></b></a>
            <ul class="dropdown-menu">
            {{ range .Children }}
                <li{{if $currentNode.IsMenuCurrent $menu .Name}} class="active"{{end}}><a href="{{.Url}}"> {{ .Name }} </a> </li>
            {{ end }}
            </ul>
          {{else}}
            <li>
            <a href="{{.Url}}"> {{ .Name }} </a>
          {{end}}
          </li>
      {{end}}
      <li><a href="http://github.com/spf13/hugo/releases"><i class="icon-arrow-down "> </i></a></li>
      <li><a href="http://github.com/spf13/hugo"><i class="icon-octocat icon-2x"> </i></a></li>
    </ul>
  </div><!-- /.navbar-collapse -->
</nav>
