hugo-theme-cybercards/layouts/shortcodes/ilink.html

13 lines
512 B
HTML

{{- $this := $.Page -}}
{{- $pages := where .Site.RegularPages "Params.pageid" "eq" (.Get "pid") -}}
{{- $frag := .Get "id" -}}
{{- $fragsep := "" -}}
{{- if ne $frag "" -}}{{- $fragsep = "#" -}}{{- end -}}
{{- $inner := .Inner -}}
{{- range $pages -}}
{{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}}
{{- $text := or $inner .Title -}}
<a id="{{ $text | anchorize }}"
href="{{ $url }}">{{ $text | markdownify }}</a>
{{- .Scratch.SetInMap "backlinks" (anchorize $text) $this -}}
{{- end -}}