2022-08-24 03:32:40 +00:00
|
|
|
<h3>{{ i18n "backlinks" }}</h3>
|
2021-07-18 17:02:53 +00:00
|
|
|
<ul class="backlinks">
|
2021-08-12 13:29:35 +00:00
|
|
|
{{$url := urls.Parse .Site.BaseURL }}
|
|
|
|
{{$host := strings.TrimRight "/" $url.Path }}
|
2022-04-02 19:59:38 +00:00
|
|
|
{{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink)}}
|
2022-03-04 02:25:30 +00:00
|
|
|
{{$linkIndex := getJSON "/assets/indices/linkIndex.json"}}
|
2022-02-16 00:39:14 +00:00
|
|
|
{{$inbound := index $linkIndex.index.backlinks $curPage}}
|
2022-03-04 02:25:30 +00:00
|
|
|
{{$contentTable := getJSON "/assets/indices/contentIndex.json"}}
|
2021-07-18 17:02:53 +00:00
|
|
|
{{if $inbound}}
|
2022-05-05 04:58:50 +00:00
|
|
|
{{$backlinks := dict "SENTINEL" "SENTINEL"}}
|
|
|
|
{{range $k, $v := $inbound}}
|
|
|
|
{{$cleanedInbound := replace $v.source " " "-"}}
|
|
|
|
{{$ctx := $v.text}}
|
|
|
|
{{$backlinks = merge $backlinks (dict $cleanedInbound $ctx)}}
|
|
|
|
{{end}}
|
|
|
|
{{- range $lnk, $ctx := $backlinks -}}
|
|
|
|
{{$l := printf "%s%s/" $host $lnk}}
|
2022-05-03 14:43:22 +00:00
|
|
|
{{$l = cond (eq $l "//") "/" $l}}
|
2022-05-05 04:58:50 +00:00
|
|
|
{{with (index $contentTable $lnk)}}
|
2022-04-01 06:15:54 +00:00
|
|
|
<li>
|
2022-05-05 04:58:50 +00:00
|
|
|
<a href="{{$l}}" data-ctx="{{$ctx}}" data-src="{{$lnk}}" class="internal-link">{{index (index . "title")}}</a>
|
2022-04-01 06:15:54 +00:00
|
|
|
</li>
|
|
|
|
{{end}}
|
2021-07-18 13:35:42 +00:00
|
|
|
{{- end -}}
|
2021-07-18 17:02:53 +00:00
|
|
|
{{else}}
|
|
|
|
<li>
|
2022-08-24 03:32:40 +00:00
|
|
|
{{ i18n "no_backlinks" }}
|
2021-07-18 17:02:53 +00:00
|
|
|
</li>
|
|
|
|
{{end}}
|
2021-12-23 22:05:27 +00:00
|
|
|
</ul>
|