From a22b6d068311e008059922944ca9cce7a34f646b Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Thu, 10 Dec 2020 01:57:13 +0100 Subject: [PATCH] backlinks for authors from page params --- layouts/partials/scratch.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/layouts/partials/scratch.html b/layouts/partials/scratch.html index 881bdf2..3cbf6a8 100644 --- a/layouts/partials/scratch.html +++ b/layouts/partials/scratch.html @@ -23,6 +23,17 @@ {{ end }} {{ end }} + {{ with $authors := $p.Params.authors }} + {{ range $author := $authors }} + {{ $authorLink := printf "/author/%s" $author }} + {{ with ($_.Get $authorLink) }} + {{ $_.SetInMap $authorLink "backlinks" (uniq ((index ($_.Get $authorLink) "backlinks") | append $p)) }} + {{ else }} + {{ $_.SetInMap $authorLink "backlinks" (slice $p) }} + {{ end }} + {{ end }} + {{ end }} + {{ $gp := $.GetPage $pPath }} {{ $gpPath := printf "/%s" $gp.File }} {{ range $k, $v := $gp.Params }}