Add backlinks to default page; fix bug

This commit is contained in:
David Eisinger
2023-10-30 15:12:37 -04:00
parent a07608d2a7
commit 4324f4e21e
3 changed files with 6 additions and 3 deletions

View File

@@ -4,4 +4,7 @@
<h2>{{ .Title }}</h2>
{{ .Content }}
{{- partial "references.html" . -}}
{{- partial "backlinks.html" . -}}
{{ end }}

View File

@@ -1,9 +1,9 @@
{{ $currlink := .RelPermalink }}
{{ $noslash := substr .RelPermalink 0 -1 }}
{{ $link := printf `href="%s` (substr .RelPermalink 0 -1) }}
{{ $backlinks := slice }}
{{ range .Site.Pages }}
{{ $found := findRE $noslash .Content 1 }}
{{ $found := findRE $link .Content 1 }}
{{ if and ($found) (ne $currlink .RelPermalink) }}
{{ $backlinks = $backlinks | append . }}