quartz-research-note/layouts/partials/backlinks.html

25 lines
836 B
HTML
Raw Normal View History

<h3>Backlinks</h3>
<ul class="backlinks">
2021-08-12 13:29:35 +00:00
{{$url := urls.Parse .Site.BaseURL }}
{{$host := strings.TrimRight "/" $url.Path }}
{{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink)}}
{{$linkIndex := getJSON "/assets/indices/linkIndex.json"}}
2022-02-16 00:39:14 +00:00
{{$inbound := index $linkIndex.index.backlinks $curPage}}
{{$contentTable := getJSON "/assets/indices/contentIndex.json"}}
{{if $inbound}}
2021-12-27 18:15:10 +00:00
{{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
{{- range $cleanedInbound | uniq -}}
{{$l := printf "%s%s" $host .}}
{{with (index $contentTable .)}}
<li>
<a href="{{$l}}">{{index (index . "title")}}</a>
</li>
{{end}}
2021-07-18 13:35:42 +00:00
{{- end -}}
{{else}}
<li>
No backlinks found
</li>
{{end}}
</ul>