From b0e15e0cbc445e12e3aabfe90ee2fc6bf2c33782 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 02 May 2022 16:19:26 +0000
Subject: [PATCH] Merge pull request #118 from aidenybai/add-router
---
layouts/partials/backlinks.html | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html
index 48ffecc..deb82e8 100644
--- a/layouts/partials/backlinks.html
+++ b/layouts/partials/backlinks.html
@@ -2,21 +2,23 @@
<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}}
+ {{$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 -}}
- {{$src := index . "source"}}
- {{$src = replace $src " " "-"}}
- {{$src = replace $src `\` ""}}
-
- <li>
- <a href="../{{$src | safeHTML}}">{{index . "source"}}</a>
- </li>
+ {{$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}}
{{- end -}}
{{else}}
<li>
No backlinks found
</li>
{{end}}
-</ul>
\ No newline at end of file
+</ul>
--
Gitblit v1.10.0