fix: base.com not being resolved properly with joinSegments

This commit is contained in:
Jacky Zhao 2024-02-13 01:27:27 -08:00
parent 880a9511b6
commit b87a701ff7

View file

@ -108,7 +108,7 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options> | undefined> =
// url.resolve is considered legacy // url.resolve is considered legacy
// WHATWG equivalent https://nodejs.dev/en/api/v18/url/#urlresolvefrom-to // WHATWG equivalent https://nodejs.dev/en/api/v18/url/#urlresolvefrom-to
const url = new URL(dest, joinSegments(`https://base.com/`, curSlug)) const url = new URL(dest, "https://base.com/" + stripSlashes(curSlug, true))
const canonicalDest = url.pathname const canonicalDest = url.pathname
let [destCanonical, _destAnchor] = splitAnchor(canonicalDest) let [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
if (destCanonical.endsWith("/")) { if (destCanonical.endsWith("/")) {