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 }}
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- with .sect }}
{{- $currentIsActive := eq .RelPermalink $currentFileRelPermalink }}
{{- $isActive = or $currentIsActive $isActive }}
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isActive = or $isSelf $isActive }}
{{- $pages := .Pages }}
{{- if .Page.IsHome }}
{{- $pages = .Sections }}
@ -37,7 +37,8 @@
{{- $pages = (.Pages | union .Sections) }}
{{- end }}
{{- $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 }}
{{- else if or .IsSection .IsHome }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}

View file

@ -116,7 +116,9 @@
{{- $alwaysopen := .alwaysopen }}
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- with .sect }}
{{- $isActive := eq .RelPermalink $currentFileRelPermalink }}
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $isActive := $isSelf }}
{{- $pages := .Pages }}
{{- if .Page.IsHome }}
{{- $pages = .Sections }}
@ -124,13 +126,13 @@
{{- $pages = (.Pages | union .Sections) }}
{{- end }}
{{- $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 }}
{{- else if or .IsSection .IsHome }}
{{- $numberOfVisibleChildren := 0 }}
{{- range $pages }}
{{- $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)) }}
{{- end }}
{{- safeHTML .Params.head }}
@ -139,8 +141,8 @@
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
{{- $pageHash := md5 .Page }}
{{- $isOpen := or $currentAlwaysopen (.IsAncestor $currentNode) }}
<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}}">
{{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
<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" . }}
{{- if $showvisitedlinks }}<i class="fas fa-check read-icon"></i>{{ end }}</a><ul>
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }}