fix: append trailing slash, fixes #111

This commit is contained in:
Jacky Zhao 2022-04-28 10:48:31 -07:00
parent 9daef8557b
commit 5451e16dd8
3 changed files with 3 additions and 3 deletions

View File

@ -127,7 +127,7 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
.attr("fill", color) .attr("fill", color)
.style("cursor", "pointer") .style("cursor", "pointer")
.on("click", (_, d) => { .on("click", (_, d) => {
window.location.href = baseUrl + '/' + decodeURI(d.id).replace(/\s+/g, '-') window.location.href = `${baseUrl}/${decodeURI(d.id).replace(/\s+/g, '-')}/`
}) })
.on("mouseover", function(_, d) { .on("mouseover", function(_, d) {
d3.selectAll(".node") d3.selectAll(".node")

View File

@ -131,7 +131,7 @@ const removeMarkdown = (
} }
const redir = (id, term) => { const redir = (id, term) => {
window.location.href = BASE_URL + `${id}#:~:text=${encodeURIComponent(term)}` window.location.href = `${BASE_URL}${id}#:~:text=${encodeURIComponent(term)}/`
} }
const formatForDisplay = id => ({ const formatForDisplay = id => ({

View File

@ -9,7 +9,7 @@
{{if $inbound}} {{if $inbound}}
{{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}} {{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
{{- range $cleanedInbound | uniq -}} {{- range $cleanedInbound | uniq -}}
{{$l := printf "%s%s" $host .}} {{$l := printf "%s%s/" $host .}}
{{with (index $contentTable .)}} {{with (index $contentTable .)}}
<li> <li>
<a href="{{$l}}">{{index (index . "title")}}</a> <a href="{{$l}}">{{index (index . "title")}}</a>