From 17e9e855883217b630b782d28b87e73b14f30d17 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Thu, 26 Oct 2023 08:02:23 +0200 Subject: [PATCH] add shortcode 'embed' --- layouts/shortcodes/embed.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 layouts/shortcodes/embed.html diff --git a/layouts/shortcodes/embed.html b/layouts/shortcodes/embed.html new file mode 100644 index 0000000..3d0e9ba --- /dev/null +++ b/layouts/shortcodes/embed.html @@ -0,0 +1,14 @@ +{{- $pid := or (.Get "pid") (.Get "page") -}} +{{- $this := $.Page -}} +{{- $linkid := or ($this.Scratch.Get "linkid") 1 -}} +{{- $this.Scratch.Set "linkid" (add $linkid 1) -}} +{{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} +{{- $btext := or (.Get "btext") (printf "%d" $linkid) -}} +{{- $btitle := .Get "btitle" -}} + +{{- range $pages -}} + {{- .Scratch.Add "backlinks" (slice (dict "page" $this "btext" $btext "btitle" $btitle)) -}} +### [{{ .Title }}]({{ .Permalink }}) + + {{ .RenderShortcodes }} +{{- end -}}