public_notes/layouts/partials/backlinks.html

22 lines
757 B
HTML
Raw Normal View History

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