From 5451e16dd8df710a290fe51d581a937c1e328eec Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 28 Apr 2022 10:48:31 -0700 Subject: [PATCH] fix: append trailing slash, fixes #111 --- assets/js/graph.js | 2 +- assets/js/search.js | 2 +- layouts/partials/backlinks.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/graph.js b/assets/js/graph.js index f0b1f7f6..08c97e99 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -127,7 +127,7 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege .attr("fill", color) .style("cursor", "pointer") .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) { d3.selectAll(".node") diff --git a/assets/js/search.js b/assets/js/search.js index facebe56..0aacb5f4 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -131,7 +131,7 @@ const removeMarkdown = ( } 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 => ({ diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html index 425ec67c..deb82e82 100644 --- a/layouts/partials/backlinks.html +++ b/layouts/partials/backlinks.html @@ -9,7 +9,7 @@ {{if $inbound}} {{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}} {{- range $cleanedInbound | uniq -}} - {{$l := printf "%s%s" $host .}} + {{$l := printf "%s%s/" $host .}} {{with (index $contentTable .)}}
  • {{index (index . "title")}}