Move features.maxnavitems into topNavbar.maxVisibleSections

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
hossainemruz 2022-01-14 01:27:51 +06:00
parent 5efe21a9c5
commit 69558d4de9

View file

@ -1,7 +1,7 @@
{{/* variables for enabling/disabling various features */}} {{/* variables for enabling/disabling various features */}}
{{ $blogEnabled := site.Params.features.blog.enable | default false }} {{ $blogEnabled := site.Params.features.blog.enable | default false }}
{{ $notesEnabled := site.Params.features.notes.enable | default false }} {{ $notesEnabled := site.Params.features.notes.enable | default false }}
{{ $maxnavitems := site.Params.features.maxnavitems | default 5 }} {{ $maxVisibleSections := site.Params.topNavbar.maxVisibleSections | default 5 }}
{{/* keep backward compatibility for blog post */}} {{/* keep backward compatibility for blog post */}}
{{ if site.Params.enableBlogPost }} {{ if site.Params.enableBlogPost }}
@ -72,18 +72,18 @@
<a class="nav-link" href="#home">{{ i18n "home" }}</a> <a class="nav-link" href="#home">{{ i18n "home" }}</a>
</li> </li>
{{ if $sections }} {{ if $sections }}
{{ $sectionCount := 0}} {{ $sectionCount := 1 }}
{{ range sort $sections "section.weight" }} {{ range sort $sections "section.weight" }}
{{ if and (.section.enable) (.section.showOnNavbar)}} {{ if and (.section.enable) (.section.showOnNavbar)}}
{{ $sectionCount = add $sectionCount 1}} {{ $sectionCount = add $sectionCount 1}}
{{ if le $sectionCount $maxnavitems }} {{ if le $sectionCount $maxVisibleSections }}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a> <a class="nav-link" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
</li> </li>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ if gt $sectionCount $maxnavitems }} {{ if gt $sectionCount $maxVisibleSections }}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{i18n "more" }}</a> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{i18n "more" }}</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> <div class="dropdown-menu" aria-labelledby="navbarDropdown">
@ -91,7 +91,7 @@
{{ range sort $sections "section.weight" }} {{ range sort $sections "section.weight" }}
{{ if and (.section.enable) (.section.showOnNavbar) }} {{ if and (.section.enable) (.section.showOnNavbar) }}
{{ $sectionCount = add $sectionCount 1}} {{ $sectionCount = add $sectionCount 1}}
{{ if gt $sectionCount $maxnavitems }} {{ if gt $sectionCount $maxVisibleSections }}
<a class="dropdown-item" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a> <a class="dropdown-item" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
{{ end }} {{ end }}
{{ end }} {{ end }}