From 5ff086306af0c37079c87806c146297f934c8ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 23 Jun 2022 15:32:01 +0200 Subject: [PATCH] print: fix empty page for shortcut links #283 --- layouts/partials/body.print.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/layouts/partials/body.print.html b/layouts/partials/body.print.html index 9f1637fb96..68bee1658d 100644 --- a/layouts/partials/body.print.html +++ b/layouts/partials/body.print.html @@ -1,5 +1,14 @@ {{- $currentNode := . }} {{- $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 }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }} @@ -29,6 +38,7 @@ {{- $currentFileRelPermalink := .currentnode.RelPermalink }} {{- with .sect }} {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }} + {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }} {{- $isActive = or $isSelf $isActive }} {{- $pages := .Pages }} {{- if .Page.IsHome }} @@ -37,7 +47,6 @@ {{- $pages = (.Pages | union .Sections) }} {{- end }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} - {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }} {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- if $hidden }} {{- else if or .IsSection .IsHome }}