From e4cc625c33ecd2992dcf60f408417c3067b4fa2b Mon Sep 17 00:00:00 2001
From: Aiden Bai <aiden.bai05@gmail.com>
Date: Tue, 03 May 2022 16:34:27 +0000
Subject: [PATCH] Add future note about init function
---
layouts/partials/backlinks.html | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html
index 746ebbb..e42351a 100644
--- a/layouts/partials/backlinks.html
+++ b/layouts/partials/backlinks.html
@@ -2,16 +2,20 @@
<ul class="backlinks">
{{$url := urls.Parse .Site.BaseURL }}
{{$host := strings.TrimRight "/" $url.Path }}
- {{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink) }}
- {{$linkIndex := getJSON "/static/linkIndex.json"}}
+ {{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink)}}
+ {{$linkIndex := getJSON "/assets/indices/linkIndex.json"}}
{{$inbound := index $linkIndex.index.backlinks $curPage}}
- {{$contentTable := getJSON "/static/contentIndex.json"}}
+ {{$contentTable := getJSON "/assets/indices/contentIndex.json"}}
{{if $inbound}}
{{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
{{- range $cleanedInbound | uniq -}}
- <li>
- <a href="{{.}}">{{index (index $contentTable .) "title"}}</a>
- </li>
+ {{$l := printf "%s%s/" $host .}}
+ {{$l = cond (eq $l "//") "/" $l}}
+ {{with (index $contentTable .)}}
+ <li>
+ <a href="{{$l}}">{{index (index . "title")}}</a>
+ </li>
+ {{end}}
{{- end -}}
{{else}}
<li>
--
Gitblit v1.10.0