👷 Add sidebar menu items.

This commit is contained in:
凡梦星尘
2022-05-25 15:44:10 +08:00
parent fc52303ad1
commit cdbb3f751a
6 changed files with 70 additions and 6 deletions

View File

@@ -5,6 +5,8 @@
{{- $pluginVen := $P.vendors.plugins -}}
{{- $pluginCDN := index $vendors $pluginVen -}}
{{- .Scratch.Set "pluginCDN" $pluginCDN -}}
{{ $posts := len .Site.RegularPages }}
{{- .Scratch.Set "posts" $posts -}}
<!DOCTYPE html>
<html lang="{{ $lang }}">

View File

@@ -1 +1,2 @@
{{ partial "header/brand" . }}
{{ partial "header/brand" . }}
{{ partial "header/menus" . }}

View File

@@ -0,0 +1,27 @@
{{- $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>