Find first section for chevron navigation (#26)

* Find first section for chevron navigation

* Handle disabled section

Co-authored-by: hossainemruz <emruz@appscode.com>
This commit is contained in:
Jason Tipton 2020-07-02 07:21:09 -08:00 committed by GitHub
parent 436746b170
commit 8658773212
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -25,7 +25,10 @@
<li>{{ . }}</li>
{{ end }}
</ul>
<!-- @todo this section should go to the first section, not necessarily about -->
<a href="#about"><i class="arrow bounce fa fa-chevron-down"></i></a>
{{ if .Site.Data.sections }}
{{ range first 1 (where (sort .Site.Data.sections "section.weight") ".section.enable" true) }}
<a href="#{{ replace (lower .section.name) " " "-" }}"><i class="arrow bounce fa fa-chevron-down"></i></a>
{{ end }}
{{ end }}
</div>
</div>

View file

@ -21,7 +21,7 @@
</li>
{{- if .Site.Data.sections }}
{{- range sort .Site.Data.sections "section.weight" }}
{{ if .section.showOnNavbar }}
{{ if (and .section.enable .section.showOnNavbar) }}
<li class="nav-item">
<a class="nav-link smooth-scroll" href="#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
</li>