mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
fix: use absolute asset paths for 404 page so it works in subdirectories
This commit is contained in:
parent
8dcc1522d9
commit
02d0f23030
@ -76,7 +76,13 @@ async function emitPage(
|
||||
resources: StaticResources,
|
||||
) {
|
||||
const cfg = ctx.cfg.configuration
|
||||
const externalResources = pageResources(pathToRoot(slug), resources)
|
||||
// For the 404 page, use an absolute base path so assets resolve correctly
|
||||
// when the hosting provider serves 404.html from any URL depth
|
||||
const baseDir =
|
||||
slug === "404"
|
||||
? (new URL(`https://${cfg.baseUrl ?? "example.com"}`).pathname as FullSlug)
|
||||
: pathToRoot(slug)
|
||||
const externalResources = pageResources(baseDir, resources)
|
||||
const componentData: QuartzComponentProps = {
|
||||
ctx,
|
||||
fileData,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user