quartz/layouts/partials/backlinks.html
2021-08-12 09:29:35 -04:00

18 lines
518 B
HTML

<h3>Backlinks</h3>
<ul class="backlinks">
{{$url := urls.Parse .Site.BaseURL }}
{{$host := strings.TrimRight "/" $url.Path }}
{{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink) }}
{{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}}
{{if $inbound}}
{{- range $inbound -}}
<li>
<a href="{{index . "source"}}">{{index . "source"}}</a>
</li>
{{- end -}}
{{else}}
<li>
No backlinks found
</li>
{{end}}
</ul>