Created get-section-url helper

This commit is contained in:
David Davó 2023-10-02 20:50:54 +02:00
parent 960f8ca94c
commit 5a785c8e2a
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
{{- if page.IsHome -}}
#{{ partial "helpers/get-section-id.html" . }}
{{- else -}}
{{ site.BaseURL | relLangURL }}#{{ partial "helpers/get-section-id.html" . }}
{{- end -}}

View file

@ -88,7 +88,7 @@
{{ $sectionCount = add $sectionCount 1}}
{{ if le $sectionCount $maxVisibleSections }}
<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-url.html" . }}">{{ .section.name }}</a>
</li>
{{ end }}
{{ end }}
@ -102,7 +102,7 @@
{{ if and (.section.enable) (.section.showOnNavbar) }}
{{ $sectionCount = add $sectionCount 1}}
{{ 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-url.html" . }}">{{ .section.name }}</a>
{{ end }}
{{ end }}
{{- end }}