<div id="sidebar">
  <a href="{{.Site.BaseURL}}" id="sidebar-logo"><img src="{{ "logo/logo.png" | relURL }}" width="100%" /></a>
  <div style="background-color: #0000001a; width: 100%; height: 1px; min-height: .1em;"></div>
  <ul>
    {{ $currentPage := . }}
    {{ range .Site.Menus.main }}
      {{ if .HasChildren }}
        <li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">{{ .Pre }}<span>{{ .Name }}</span></li>
        <ul class="sub-menu">
          {{ range .Children }}
            <li class="{{ if $currentPage.IsMenuCurrent "main" . }}active-entry{{ end }}">
              <a href="{{ .URL }}">{{ .Name }}</a>
            </li>
          {{ end }}
        </ul>
      {{ else }}
        {{ if .Name }}
          <li class="{{ if $currentPage.IsMenuCurrent "main" . }}active-entry{{ end }}">
            <a href="{{ .URL }}">
              {{ .Pre }}
              <span>{{ .Name }}</span>
            </a>
          </li>
        {{end}}
      {{ end }}
    {{ end }}
  </ul>
</div>