theme: make compatible with Hugo 0.100.0 #263

This commit is contained in:
Sören Weber 2022-06-06 21:11:44 +02:00
parent 1189587920
commit e88b9ecebb
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 11 additions and 8 deletions

View file

@ -28,8 +28,8 @@
{{- $isActive := .isActive }} {{- $isActive := .isActive }}
{{- $currentFileRelPermalink := .currentnode.RelPermalink }} {{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- with .sect }} {{- with .sect }}
{{- $currentIsActive := eq .RelPermalink $currentFileRelPermalink }} {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isActive = or $currentIsActive $isActive }} {{- $isActive = or $isSelf $isActive }}
{{- $pages := .Pages }} {{- $pages := .Pages }}
{{- if .Page.IsHome }} {{- if .Page.IsHome }}
{{- $pages = .Sections }} {{- $pages = .Sections }}
@ -37,7 +37,8 @@
{{- $pages = (.Pages | union .Sections) }} {{- $pages = (.Pages | union .Sections) }}
{{- end }} {{- end }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not (.IsAncestor $currentNode)) }} {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
{{- if $hidden }} {{- if $hidden }}
{{- else if or .IsSection .IsHome }} {{- else if or .IsSection .IsHome }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}

View file

@ -116,7 +116,9 @@
{{- $alwaysopen := .alwaysopen }} {{- $alwaysopen := .alwaysopen }}
{{- $currentFileRelPermalink := .currentnode.RelPermalink }} {{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- with .sect }} {{- with .sect }}
{{- $isActive := eq .RelPermalink $currentFileRelPermalink }} {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $isActive := $isSelf }}
{{- $pages := .Pages }} {{- $pages := .Pages }}
{{- if .Page.IsHome }} {{- if .Page.IsHome }}
{{- $pages = .Sections }} {{- $pages = .Sections }}
@ -124,13 +126,13 @@
{{- $pages = (.Pages | union .Sections) }} {{- $pages = (.Pages | union .Sections) }}
{{- end }} {{- end }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not (.IsAncestor $currentNode)) }} {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
{{- if $hidden }} {{- if $hidden }}
{{- else if or .IsSection .IsHome }} {{- else if or .IsSection .IsHome }}
{{- $numberOfVisibleChildren := 0 }} {{- $numberOfVisibleChildren := 0 }}
{{- range $pages }} {{- range $pages }}
{{- $relearnIsSubHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $relearnIsSubHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $subHidden := and $relearnIsSubHiddenFrom (not $.showhidden) (not (.IsAncestor $currentNode)) }} {{- $subHidden := and $relearnIsSubHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
{{- $numberOfVisibleChildren = add $numberOfVisibleChildren (int (not $subHidden)) }} {{- $numberOfVisibleChildren = add $numberOfVisibleChildren (int (not $subHidden)) }}
{{- end }} {{- end }}
{{- safeHTML .Params.head }} {{- safeHTML .Params.head }}
@ -139,8 +141,8 @@
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }} {{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }} {{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
{{- $pageHash := md5 .Page }} {{- $pageHash := md5 .Page }}
{{- $isOpen := or $currentAlwaysopen (.IsAncestor $currentNode) }} {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if $isActive }} active{{end}}{{if .IsAncestor $currentNode }} parent{{end}}{{if $currentAlwaysopen}} alwaysopen{{end}}"><input type="checkbox" id="section-{{ $pageHash }}" class="toggle"{{ if $isOpen }} checked{{ end }}/><label for="section-{{ $pageHash }}" ></label><a href="{{.RelPermalink}}"> <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if $isActive }} active{{end}}{{if (or $isSelf $isAncestor) }} parent{{end}}{{if $currentAlwaysopen}} alwaysopen{{end}}"><input type="checkbox" id="section-{{ $pageHash }}" class="toggle"{{ if $isOpen }} checked{{ end }}/><label for="section-{{ $pageHash }}" ></label><a href="{{.RelPermalink}}">
{{- partial "menu-pre.html" . }}{{ or .Params.menuTitle .LinkTitle .Title }}{{ partial "menu-post.html" . }} {{- partial "menu-pre.html" . }}{{ or .Params.menuTitle .LinkTitle .Title }}{{ partial "menu-post.html" . }}
{{- if $showvisitedlinks }}<i class="fas fa-check read-icon"></i>{{ end }}</a><ul> {{- if $showvisitedlinks }}<i class="fas fa-check read-icon"></i>{{ end }}</a><ul>
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }} {{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }}