print: don't print rest of site for shortcut links #283

This commit is contained in:
Sören Weber 2022-06-23 19:45:52 +02:00
parent 5ff086306a
commit 3e489145e7
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -1,17 +1,21 @@
{{- $currentNode := . }}
{{- $isActive := .IsHome }}
{{- $isShortcut := false }}
{{- $r_url := .RelPermalink }}
{{- with .Site.Menus.shortcuts }}
{{- range sort . "Weight" }}
{{- $s_url := .URL | relLangURL }}
{{- if (eq $s_url $r_url) }}
{{- $isActive = true }}
{{- $isShortcut = true }}
{{- end }}
{{- end }}
{{- end }}
{{- $pages := .Site.Home.Sections }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- if $isShortcut }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
{{- else }}
{{- if $isActive }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
{{- if or .IsHome .Params.chapter $pages }}
@ -32,6 +36,7 @@
</section>
{{- end }}
{{- end }}
{{- end }}
{{- define "section-tree-print" }}
{{- $currentNode := .currentnode }}
{{- $isActive := .isActive }}