diff --git a/assets/js/graph.js b/assets/js/graph.js index 939fd99d8..99ecf54ee 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -16,9 +16,8 @@ async function drawGraph( ...new Set(links.flatMap((link) => [link.source, link.target])), ]; - // links is mutated by d3 - // we want to use links later on, so we make a copy and pass - // that one to d3 + // Links is mutated by d3. We want to use links later on, so we make a copy and pass that one to d3 + // Note: shallow cloning does not work because it copies over references from the original array const copyLinks = JSON.parse(JSON.stringify(links)); const neighbours = new Set(); @@ -176,6 +175,7 @@ async function drawGraph( .attr('fill', color) .style('cursor', 'pointer') .on('click', (_, d) => { + // SPA navigation window.navigate( new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, '-')}/`), '.singlePage' diff --git a/assets/js/search.js b/assets/js/search.js index 212b2c730..fcf79177d 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -145,6 +145,7 @@ const removeMarkdown = ( }; const redir = (id, term) => { + // SPA navigation window.navigate( new URL( `${BASE_URL.slice(0, -1)}${id}#:~:text=${encodeURIComponent(term)}/` diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 772153ada..ea67a001c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -57,9 +57,12 @@