Created get-section-url helper
This commit is contained in:
parent
960f8ca94c
commit
5a785c8e2a
2 changed files with 7 additions and 2 deletions
5
layouts/partials/helpers/get-section-url.html
Normal file
5
layouts/partials/helpers/get-section-url.html
Normal 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 -}}
|
|
@ -88,7 +88,7 @@
|
||||||
{{ $sectionCount = add $sectionCount 1}}
|
{{ $sectionCount = add $sectionCount 1}}
|
||||||
{{ if le $sectionCount $maxVisibleSections }}
|
{{ 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-url.html" . }}">{{ .section.name }}</a>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
{{ if and (.section.enable) (.section.showOnNavbar) }}
|
{{ if and (.section.enable) (.section.showOnNavbar) }}
|
||||||
{{ $sectionCount = add $sectionCount 1}}
|
{{ $sectionCount = add $sectionCount 1}}
|
||||||
{{ if gt $sectionCount $maxVisibleSections }}
|
{{ 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 }}
|
{{ end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue