hugo-theme-next/layouts/partials/header/menus.html
2022-05-25 15:44:10 +08:00

27 lines
991 B
HTML

{{- $ms := .P.menuSets }}
{{- $curP := .Page }}
{{- $post := .Scratch.Get "posts" }}
<nav class="site-nav">
<ul class="main-menu menu">
{{- range $curP.Site.Menus.main }}
{{- $active := or ($curP.IsMenuCurrent "main" .) ($curP.HasMenuCurrent "main" .) }}
{{- $active = or $active (eq .URL "/")}}
<li class="menu-item menu-item-{{ .Identifier }}">
<a href="{{ .URL }}" class="{{if $active }} menu-item-active{{ end }}" rel="section">
{{- if $ms.icons }}<i class="fa fa-{{ .Pre }}"></i>{{ end }}{{- .Name }}
{{- if and $ms.badges (eq .Identifier "archives" ) }}
<span class="badge">{{ $post }}</span>
{{- end }}
</a>
</li>
{{- end }}
{{- if or .P.algoliaSearch.enable .P.localSearch.enable }}
<li class="menu-item menu-item-search">
<a role="button" class="popup-trigger">
{{- if $ms.icons }}<i class="fa fa-search fa-fw"></i>{{ end }}{{ T "MSearchLabel" }}
</a>
</li>
{{- end }}
</ul>
</nav>