configurable navbar item count

Make the number of navbar items outside "More" configurable via

```
config.yaml
---
params:
  features:
    maxnavitems: 6
```
This commit is contained in:
Jan 2022-01-12 14:40:10 +01:00 committed by GitHub
parent 2134464267
commit 75ad6902a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 }}
{{ $maxnavitems := site.Params.features.maxnavitems | default 5 }}
{{/* keep backward compatibility for blog post */}}
{{ if site.Params.enableBlogPost }}
@ -75,7 +76,7 @@
{{ range sort $sections "section.weight" }}
{{ if and (.section.enable) (.section.showOnNavbar)}}
{{ $sectionCount = add $sectionCount 1}}
{{ if le $sectionCount 5 }}
{{ if le $sectionCount $maxnavitems }}
<li class="nav-item">
<a class="nav-link" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
</li>