From 094ab9d064b8e3d24f0cb656aaf4e0ea08365ac5 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 27 Dec 2021 18:15:10 +0000
Subject: [PATCH] dedupe backlinks
---
content/notes/config.md | 1 +
layouts/partials/backlinks.html | 8 +++-----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/content/notes/config.md b/content/notes/config.md
index 6f5ef74..a5c194f 100644
--- a/content/notes/config.md
+++ b/content/notes/config.md
@@ -29,6 +29,7 @@
enableLegend: false # automatically generate a legend
enableDrag: true # allow dragging nodes in the graph
enableZoom: true # allow zooming and panning the graph
+depth: -1 # how many neighbours of the current node to show (-1 is all nodes)
paths: # colour specific nodes path off of their path
- /moc: "#4388cc"
```
diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html
index 9020bf7..daee6ec 100644
--- a/layouts/partials/backlinks.html
+++ b/layouts/partials/backlinks.html
@@ -6,12 +6,10 @@
{{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}}
{{$contentTable := $.Site.Data.contentIndex}}
{{if $inbound}}
- {{- range $inbound -}}
- {{$src := index . "source"}}
- {{$src = replace $src " " "-"}}
-
+ {{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
+ {{- range $cleanedInbound | uniq -}}
<li>
- <a href="{{$src}}">{{index (index $contentTable $src) "title"}}</a>
+ <a href="{{.}}">{{index (index $contentTable .) "title"}}</a>
</li>
{{- end -}}
{{else}}
--
Gitblit v1.10.0