Fix current page highlight in new Hugo version

This commit is contained in:
Alex Shpak 2020-03-30 18:00:15 +02:00
parent 831e570f16
commit a9867292af

View file

@ -38,9 +38,9 @@
{{ with .Section }} {{ with .Section }}
<ul> <ul>
{{ range where .Pages "Params.bookhidden" "!=" "true" }} {{ range where .Pages "Params.bookhidden" "!=" "true" }}
{{ if eq .Kind "section" }} {{ if .IsSection }}
{{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }} {{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }}
{{ else if and (eq .Kind "page") .Content }} {{ else if and .IsPage .Content }}
<li> <li>
{{- template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) -}} {{- template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) -}}
</li> </li>
@ -57,7 +57,7 @@
{{ if .Content }} {{ if .Content }}
<a href="{{ .RelPermalink }}" class=" <a href="{{ .RelPermalink }}" class="
{{- if and .Params.bookCollapseSection .IsSection }}collapsed {{ end }} {{- if and .Params.bookCollapseSection .IsSection }}collapsed {{ end }}
{{- if eq $.CurrentPage . }}active{{ end }}"> {{- if eq $.CurrentPage.RelPermalink .RelPermalink }}active{{ end }}">
{{- partial "docs/title" . -}} {{- partial "docs/title" . -}}
</a> </a>
{{ else }} {{ else }}