diff --git a/layouts/partials/list-item.html b/layouts/partials/list-item.html index 785407c..45a6106 100644 --- a/layouts/partials/list-item.html +++ b/layouts/partials/list-item.html @@ -1,15 +1,23 @@ -{{ range $idx, $page := . -}} +{{ range . -}}
  • - {{- $url := .Permalink -}} - {{- if eq (printf "%T" $idx) "string" -}} - {{- $url = printf "%s#%v" .Permalink $idx -}} - {{- end -}} + {{- $page := . -}} + {{- $url := "" -}} + {{- $anchor := "" -}} + {{- if reflect.IsMap . -}} + {{- $anchor = .anchor}} + {{- $page = .page}} + {{- end -}} + {{- if ne $anchor "" -}} + {{- $url = printf "%s#%v" $page.Permalink $anchor -}} + {{- else -}} + {{- $url = $page.Permalink -}} + {{- end -}} {{ .Title }}   - {{ if .Date -}} - {{ .Date.Format (i18n "dateFormat") }} - {{- else if .Params.Teaser -}}{{ .Params.Teaser }} - {{- else -}}{{ .Summary }} + class="text-decoration-none">{{ $page.Title }}   + {{ if $page.Date -}} + {{ $page.Date.Format (i18n "dateFormat") }} + {{- else if $page.Params.Teaser -}}{{ $page.Params.Teaser }} + {{- else -}}{{ $page.Summary }} {{- end }}
  • diff --git a/layouts/shortcodes/ilink.html b/layouts/shortcodes/ilink.html index a5cc5e0..9503b36 100644 --- a/layouts/shortcodes/ilink.html +++ b/layouts/shortcodes/ilink.html @@ -1,5 +1,6 @@ {{- $this := $.Page -}} -{{- $pages := where .Site.RegularPages "Params.pageid" "eq" (.Get "pid") -}} +{{- $pid := or (.Get "pid") (.Get "pageid") -}} +{{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} {{- $frag := .Get "id" -}} {{- $fragsep := "" -}} {{- if ne $frag "" -}}{{- $fragsep = "#" -}}{{- end -}} @@ -7,7 +8,8 @@ {{- range $pages -}} {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} {{- $text := or $inner .Title -}} - {{ $text | markdownify }} - {{- .Scratch.SetInMap "backlinks" (anchorize $text) $this -}} + {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this)) -}} {{- end -}}