This commit is contained in:
parent
36548d5986
commit
b444c5c13b
@ -22,7 +22,7 @@ interface Options {
|
|||||||
const defaultOptions: Options = {
|
const defaultOptions: Options = {
|
||||||
enableSiteMap: true,
|
enableSiteMap: true,
|
||||||
enableRSS: true,
|
enableRSS: true,
|
||||||
includeEmptyFiles: false,
|
includeEmptyFiles: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateSiteMap(cfg: GlobalConfiguration, idx: ContentIndex): string {
|
function generateSiteMap(cfg: GlobalConfiguration, idx: ContentIndex): string {
|
||||||
|
@ -60,11 +60,17 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options> | undefined> =
|
|||||||
dest,
|
dest,
|
||||||
transformOptions,
|
transformOptions,
|
||||||
)
|
)
|
||||||
const url = new URL(dest, `https://base.com/${curSlug}`)
|
|
||||||
|
// url.resolve is considered legacy
|
||||||
|
// WHATWG equivalent https://nodejs.dev/en/api/v18/url/#urlresolvefrom-to
|
||||||
|
const url = new URL(dest, `resolve://${curSlug}`)
|
||||||
const canonicalDest = url.pathname
|
const canonicalDest = url.pathname
|
||||||
const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
|
const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
|
||||||
const simple = decodeURI(simplifySlug(destCanonical as FullSlug)) as SimpleSlug
|
|
||||||
|
|
||||||
|
// need to decodeURIComponent here as WHATWG URL percent-encodes everything
|
||||||
|
const simple = decodeURIComponent(
|
||||||
|
simplifySlug(destCanonical as FullSlug),
|
||||||
|
) as SimpleSlug
|
||||||
outgoing.add(simple)
|
outgoing.add(simple)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ export function slugifyFilePath(fp: FilePath, excludeExt?: boolean): FullSlug {
|
|||||||
|
|
||||||
let slug = withoutFileExt
|
let slug = withoutFileExt
|
||||||
.split("/")
|
.split("/")
|
||||||
.map((segment) => segment.replace(/\s/g, "-")) // slugify all segments
|
.map((segment) => segment.replace(/\s/g, "-").replace(/%/g, "-percent")) // slugify all segments
|
||||||
.join("/") // always use / as sep
|
.join("/") // always use / as sep
|
||||||
.replace(/\/$/, "") // remove trailing slash
|
.replace(/\/$/, "") // remove trailing slash
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user