Skip to content

Instantly share code, notes, and snippets.

@jbfriedrich
Created January 5, 2022 05:16
Show Gist options
  • Save jbfriedrich/2fce7de5c55ef781d405a92da8c55ee9 to your computer and use it in GitHub Desktop.
Save jbfriedrich/2fce7de5c55ef781d405a92da8c55ee9 to your computer and use it in GitHub Desktop.

Revisions

  1. jbfriedrich created this gist Jan 5, 2022.
    14 changes: 14 additions & 0 deletions menu.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <!-- Loop through the navigation items -->
    {{ $currentPage := . }}
    {{ $menuitems := (.Site.Menus.main) }}
    {{ $len := (len $menuitems) }}

    {{ range $index, $element := $menuitems }}
    {{ $id := .Identifier }}
    <li class="header-nav-item">
    <a class="header-nav-entry{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" title="{{ .Name }}" href="{{ .URL }}">
    <span class="header-nav-entry-icon">{{ .Pre }}</span>
    <span class="header-nav-entry-text">{{ .Name }}</span>
    </a>{{ if ne (add $index 1) $len }} • {{ end }}
    </li>
    {{ end }}