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

View File

@ -201,7 +201,7 @@
const labels = graphNode.append("text")
.attr("dx", 12)
.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("pointer-events", "none")
.call(drag(simulation));