backlinks for authors from page params

This commit is contained in:
Marcell Mars 2020-12-10 01:57:13 +01:00
parent 132f0b7945
commit a22b6d0683

View file

@ -23,6 +23,17 @@
{{ end }} {{ end }}
{{ 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 }} {{ $gp := $.GetPage $pPath }}
{{ $gpPath := printf "/%s" $gp.File }} {{ $gpPath := printf "/%s" $gp.File }}
{{ range $k, $v := $gp.Params }} {{ range $k, $v := $gp.Params }}