diff --git a/layouts/shortcodes/embed.html b/layouts/shortcodes/embed.html index a743834..d65baea 100644 --- a/layouts/shortcodes/embed.html +++ b/layouts/shortcodes/embed.html @@ -1,15 +1,17 @@ {{- $pid := or (.Get "pid") (.Get "page") -}} {{- $this := $.Page -}} +{{- $title := .Get "title" -}} +{{- $noTitle := .Get "notitle" -}} {{- $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" -}} - +{{- $anchor := printf "link-%d" $linkid -}} {{- range $pages -}} - {{- $anchor := anchorize .Title -}} - {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "btext" $btext "btitle" $btitle)) -}} -### [{{ .Title }}]({{ .Permalink }}) - + {{- if ne $title "none" -}} +### [{{ or $title .Title }}]({{ .Permalink }}) {#{{ $anchor }}} + {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "btext" $btext "btitle" $btitle)) -}} + {{- end -}} {{ .RenderShortcodes }} {{- end -}}