diff options
author | thingsym <thingsym@gmail.com> | 2022-07-07 10:57:58 +0300 |
---|---|---|
committer | thingsym <thingsym@gmail.com> | 2022-07-07 10:57:58 +0300 |
commit | d34c211c961f394d3e36071b60631d7794216b68 (patch) | |
tree | 376f8387f8cba6ea8e42b80d79361bc880d40ae5 | |
parent | 8fe225a991334a0482fbad4bed759a0722901878 (diff) |
perf: id and class elements added to menu items
-rw-r--r-- | layouts/partials/global-menu.html | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/layouts/partials/global-menu.html b/layouts/partials/global-menu.html index 132b26f..3d0e115 100644 --- a/layouts/partials/global-menu.html +++ b/layouts/partials/global-menu.html @@ -5,15 +5,15 @@ <ul> {{- range .Site.Menus.main.ByWeight -}} {{ if .HasChildren -}} -<li class="parent{{ if $currentPage.HasMenuCurrent "main" . }} active{{ end }}">{{template "menu-item" dict "item" .}} +<li{{ with .Identifier }} id="{{ . }}"{{ end }} class="parent{{ if $currentPage.HasMenuCurrent "main" . }} active{{ end }} {{ with .Params.class }}{{ . }}{{ end }}">{{template "menu-item" dict "item" .}} <ul class="sub-menu"> {{ range .Children -}} -<li class="child{{ if $currentPage.HasMenuCurrent "main" . }} active{{ end }}">{{template "menu-item" dict "item" .}}</li> +<li{{ with .Identifier }} id="{{ . }}"{{ end }} class="child{{ if $currentPage.HasMenuCurrent "main" . }} active{{ end }} {{ with .Params.class }}{{ . }}{{ end }}">{{template "menu-item" dict "item" .}}</li> {{ end -}} </ul> </li> {{- else }} -<li{{ if $currentPage.HasMenuCurrent "main" . }} class="active"{{ end }}>{{template "menu-item" dict "item" .}}</li> +<li{{ with .Identifier }} id="{{ . }}"{{ end }}{{ if $currentPage.HasMenuCurrent "main" . }} class="active {{with .Params.class}}{{ . }}{{ end }}"{{ else }} class="{{ with .Params.class }}{{ . }}{{ end }}"{{ end }}>{{template "menu-item" dict "item" .}}</li> {{- end -}} {{- end -}} </ul> @@ -29,8 +29,7 @@ {{- with .Post -}}{{- . -}}{{- end -}} {{ if .HasChildren -}} <i class="fas fa-angle-right"></i> - {{ end -}} + {{ end -}} </a> {{- end -}} {{- end -}} - |