From 8779e72c77c2e454d444b86d3d5ebda9bfab46d7 Mon Sep 17 00:00:00 2001
From: Claudio Yanes <me@claudio4.com>
Date: Fri, 04 Mar 2022 03:34:45 +0000
Subject: [PATCH] Add attribute property to scripts from jsdelivr
---
layouts/partials/backlinks.html | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html
index 21b26db..166e1fd 100644
--- a/layouts/partials/backlinks.html
+++ b/layouts/partials/backlinks.html
@@ -1,16 +1,21 @@
<h3>Backlinks</h3>
<ul class="backlinks">
- {{$curPage := strings.TrimRight "/" .Page.RelPermalink }}
- {{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}}
+ {{$url := urls.Parse .Site.BaseURL }}
+ {{$host := strings.TrimRight "/" $url.Path }}
+ {{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink) }}
+ {{$linkIndex := getJSON "/assets/indices/linkIndex.json"}}
+ {{$inbound := index $linkIndex.index.backlinks $curPage}}
+ {{$contentTable := getJSON "/assets/indices/contentIndex.json"}}
{{if $inbound}}
- {{- range $inbound -}}
- <li>
- <a href="{{index . "source"}}">{{index . "source"}}</a>
- </li>
+ {{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
+ {{- range $cleanedInbound | uniq -}}
+ <li>
+ <a href="{{$url}}{{.}}">{{index (index $contentTable .) "title"}}</a>
+ </li>
{{- end -}}
{{else}}
<li>
No backlinks found
</li>
{{end}}
-</ul>
\ No newline at end of file
+</ul>
--
Gitblit v1.10.0