From 5f3c00c14da4241a7603d21a65be458e33097a31 Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Fri, 21 Apr 2023 17:52:13 +0200 Subject: [PATCH] only mentioned editors + authors to print --- layouts/print/single.html | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/layouts/print/single.html b/layouts/print/single.html index eaeac2b..1a4a24e 100644 --- a/layouts/print/single.html +++ b/layouts/print/single.html @@ -62,6 +62,22 @@ {{ $p := $.GetPage .Params.print }} {{ $scratch := $s.Get (printf "/%s" $p.File) }} + {{ $authorsPages := (slice) }} + {{ with $p.Params.authors }} + {{ range $n, $authorFile := . }} + {{ $author := $.GetPage (printf "/author/%s" $authorFile) }} + {{ $authorsPages = (uniq $authorsPages) | append $author }} + {{ end }} + {{ end }} + + {{ $editorsPages := (slice) }} + {{ with $p.Params.editors }} + {{ range $n, $editorFile := . }} + {{ $editor := $.GetPage (printf "/editor/%s" $editorFile) }} + {{ $editorsPages = (uniq $editorsPages) | append $editor }} + {{ end }} + {{ end }} + {{ $currentDir := "" }} {{ with .File }} {{ $currentDir = .Dir }} @@ -78,8 +94,17 @@ {{ with .Params.authors }} {{ $addS = len . }} {{ end }} + + {{ with .Params.editors }} + {{ range $n, $editorFile := . }} + {{ $editor := $.GetPage (printf "/editor/%s" $editorFile) }} + {{ $editorsPages = (uniq $editorsPages) | append $editor }} + {{ end }} + {{ end }} + {{ range $n, $authorFile := .Params.authors }} {{ $author := $.GetPage (printf "/author/%s" $authorFile) }} + {{ $authorsPages = (uniq $authorsPages) | append $author }} {{ if eq $n 0 }}
author{{ with (gt $addS 1) }}s{{ end }}⁄{{ $author.Title }} {{ else }} @@ -125,8 +150,8 @@ {{ $cssHashes = printf "%s css-%s-h2" $cssHashes .File.UniqueID }} {{ end }} {{ end }} - - {{ range where $.Site.RegularPages "Section" "in" (slice "author" "editor") }} + + {{ range union (uniq $editorsPages) (uniq $authorsPages) }}
{{ index $scratch.mantle 0 }}⁄{{ $p.Title }}
{{ substr .File.Dir 0 -1 }}⁄{{ .Title }}