fix: incorrect link resolution for transclusion in root index file (#853)
Co-authored-by: Lauréline Nevin <laureline.nevin@unicaen.fr>
| | |
| | | simplifySlug, |
| | | splitAnchor, |
| | | transformLink, |
| | | joinSegments, |
| | | } from "../../util/path" |
| | | import path from "path" |
| | | import { visit } from "unist-util-visit" |
| | |
| | | |
| | | // 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 url = new URL(dest, joinSegments(`https://base.com/`, curSlug)) |
| | | const canonicalDest = url.pathname |
| | | let [destCanonical, _destAnchor] = splitAnchor(canonicalDest) |
| | | if (destCanonical.endsWith("/")) { |