Fixed backlinks.html + Prettified graph.html

This commit is contained in:
Pranav M 2022-02-13 07:50:06 -05:00
parent fa3bc3de92
commit fbc634884b
2 changed files with 7 additions and 11 deletions

View File

@ -1,20 +1,16 @@
<h3>Backlinks</h3> <h3>Backlinks</h3>
<ul class="backlinks"> <ul class="backlinks">
{{$url := urls.Parse .Site.BaseURL }} {{$curPage := strings.TrimRight "/" .Page.RelPermalink }}
{{$host := strings.TrimRight "/" $url.Path }}
{{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink) }}
{{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}} {{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}}
{{$contentTable := $.Site.Data.contentIndex}}
{{if $inbound}} {{if $inbound}}
{{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}} {{- range $inbound -}}
{{- range $cleanedInbound | uniq -}} <li>
<li> <a href="{{index . "source"}}">{{ replace (index . "source") "/notes/" "" }}</a>
<a href="{{.}}">{{index (index $contentTable .) "title"}}</a> </li>
</li>
{{- end -}} {{- end -}}
{{else}} {{else}}
<li> <li>
No backlinks found No backlinks found
</li> </li>
{{end}} {{end}}
</ul> </ul>

View File

@ -201,7 +201,7 @@
const labels = graphNode.append("text") const labels = graphNode.append("text")
.attr("dx", 12) .attr("dx", 12)
.attr("dy", ".35em") .attr("dy", ".35em")
.text((d) => content[decodeURI(d.id).replace(/\s+/g, '-')]?.title || "Untitled") .text((d) => d.id.replace(/(\/notes\/)/g, '').replace(/\s+/g, '-')) //content[decodeURI(d.id).replace(/\s+/g, '-')]?.title || "Untitled")
.style("opacity", 0) .style("opacity", 0)
.style("pointer-events", "none") .style("pointer-events", "none")
.call(drag(simulation)); .call(drag(simulation));