Jacky Zhao
2021-12-27 094ab9d064b8e3d24f0cb656aaf4e0ea08365ac5
dedupe backlinks
2 files modified
9 ■■■■■ changed files
content/notes/config.md 1 ●●●● patch | view | raw | blame | history
layouts/partials/backlinks.html 8 ●●●●● patch | view | raw | blame | history
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"
```
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}}