From 4e24b1c7bdabb504abf7cca48779e08e1ef124f5 Mon Sep 17 00:00:00 2001 From: Felix <felix.strick@udo.edu> Date: Mon, 20 Mar 2023 20:03:56 +0100 Subject: [PATCH] Update 404 page for the new format --- public/404.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/404.html b/public/404.html index ed482e3..b91e8aa 100644 --- a/public/404.html +++ b/public/404.html @@ -70,15 +70,15 @@ <script> async function addFuzzySearch() { const vanityMap = await (await fetch("/vanitymap.json")).json() - const keys = Object.keys(vanityMap); + const keys = vanityMap['shortlinks'].map((object) => object.sources).flat(1) const fuse = new Fuse(keys, {}) const pathToSearchFor = window.location.pathname.replace("/", "").replace(".html", "").trim(); const results = fuse.search(pathToSearchFor) if (results.length !== 0) { const bestShortlink = results[0].item; - const bestHref = vanityMap[bestShortlink]; + const bestHref = vanityMap['shortlinks'].filter((object) => object.sources.includes(bestShortlink))[0].destination; - document.getElementById("suggestion-text").innerText = bestShortlink; + document.getElementById("suggestion-text").innerText = "/" + bestShortlink; document.getElementById("suggestion-href").href = bestHref; document.getElementById("suggestion-section").classList.remove("is-invisible"); } -- GitLab