From c91e62c376d481534d89084e5c04846878dff6d3 Mon Sep 17 00:00:00 2001
From: Ben Schlegel <31989404+benschlegel@users.noreply.github.com>
Date: Sun, 27 Aug 2023 00:19:45 +0000
Subject: [PATCH] Fix search bar after navigate (#424)
---
quartz/plugins/transformers/links.ts | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/quartz/plugins/transformers/links.ts b/quartz/plugins/transformers/links.ts
index d9c9c7c..26c4a32 100644
--- a/quartz/plugins/transformers/links.ts
+++ b/quartz/plugins/transformers/links.ts
@@ -60,10 +60,17 @@
dest,
transformOptions,
)
+
+ // url.resolve is considered legacy
+ // WHATWG equivalent https://nodejs.dev/en/api/v18/url/#urlresolvefrom-to
const url = new URL(dest, `https://base.com/${curSlug}`)
const canonicalDest = url.pathname
const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
- const simple = simplifySlug(destCanonical as FullSlug)
+
+ // need to decodeURIComponent here as WHATWG URL percent-encodes everything
+ const simple = decodeURIComponent(
+ simplifySlug(destCanonical as FullSlug),
+ ) as SimpleSlug
outgoing.add(simple)
}
--
Gitblit v1.10.0