add shortcode 'embed'
This commit is contained in:
parent
67bf21ac6c
commit
17e9e85588
1 changed files with 14 additions and 0 deletions
14
layouts/shortcodes/embed.html
Normal file
14
layouts/shortcodes/embed.html
Normal file
|
@ -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 -}}
|
Loading…
Add table
Reference in a new issue