diff --git a/layouts/partials/navigators/navbar.html b/layouts/partials/navigators/navbar.html index ed6cff9..33552a4 100644 --- a/layouts/partials/navigators/navbar.html +++ b/layouts/partials/navigators/navbar.html @@ -1,6 +1,7 @@ {{/* variables for enabling/disabling various features */}} {{ $blogEnabled := site.Params.features.blog.enable | default false }} {{ $notesEnabled := site.Params.features.notes.enable | default false }} +{{ $maxVisibleSections := site.Params.topNavbar.maxVisibleSections | default 5 }} {{/* keep backward compatibility for blog post */}} {{ if site.Params.enableBlogPost }} @@ -71,18 +72,18 @@ {{ i18n "home" }} {{ if $sections }} - {{ $sectionCount := 0}} + {{ $sectionCount := 1 }} {{ range sort $sections "section.weight" }} {{ if and (.section.enable) (.section.showOnNavbar)}} {{ $sectionCount = add $sectionCount 1}} - {{ if le $sectionCount 5 }} + {{ if le $sectionCount $maxVisibleSections }} {{ end }} {{ end }} {{- end }} - {{ if gt $sectionCount 5 }} + {{ if gt $sectionCount $maxVisibleSections }}