print: fix empty page for shortcut links #283

This commit is contained in:
Sören Weber 2022-06-23 15:32:01 +02:00
parent de062f2f48
commit 5ff086306a
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -1,5 +1,14 @@
{{- $currentNode := . }} {{- $currentNode := . }}
{{- $isActive := .IsHome }} {{- $isActive := .IsHome }}
{{- $r_url := .RelPermalink }}
{{- with .Site.Menus.shortcuts }}
{{- range sort . "Weight" }}
{{- $s_url := .URL | relLangURL }}
{{- if (eq $s_url $r_url) }}
{{- $isActive = true }}
{{- end }}
{{- end }}
{{- end }}
{{- $pages := .Site.Home.Sections }} {{- $pages := .Site.Home.Sections }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }} {{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
@ -29,6 +38,7 @@
{{- $currentFileRelPermalink := .currentnode.RelPermalink }} {{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- with .sect }} {{- with .sect }}
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }} {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $isActive = or $isSelf $isActive }} {{- $isActive = or $isSelf $isActive }}
{{- $pages := .Pages }} {{- $pages := .Pages }}
{{- if .Page.IsHome }} {{- if .Page.IsHome }}
@ -37,7 +47,6 @@
{{- $pages = (.Pages | union .Sections) }} {{- $pages = (.Pages | union .Sections) }}
{{- end }} {{- end }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
{{- if $hidden }} {{- if $hidden }}
{{- else if or .IsSection .IsHome }} {{- else if or .IsSection .IsHome }}