Open joequincy opened 4 months ago
index
is a special file and can't normally be used as an alias target like you are trying to do
aliasing just creates a file with that name that redirects the browser to the original page so in your case the browser fetches and redirects to /demo/main
as you saw in your reproduction
this is working as intended albeit could be warned better
Describe the bug I am authoring long-form content that does not use an
index.md
. Instead, the entrypoint.md
for a given dir has frontmatter likeThis allows me to have a
content/
file structure likeHowever when using
enableSPA: true
, links such as the breadcrumbs that point up one or more directories behave incorrectly. In the example above, the "Home" breadcrumb on/chapters/chapter-n-name
will result in the browser navigating to/chapters/main-title-of-content
instead of/main-title-of-content
.This appears to be because the content of the redirect is
fetch
'd and then patched into the current page usingminimorph
without rewriting the url in the meta tag, causing the redirect to be applied relative to the current path instead of the path the alias resides at.To Reproduce Steps to reproduce the behavior:
quartz.config.ts
hasenableSPA: true
content/
root withoutindex.md
faux-index.md
) with frontmatter containingaliases: [index]
(or multiline version)demo/child-page.md
)npx quartz build --serve
Expected behavior Quartz navigates to the aliased content at the unnested path.
Screenshots and Source I have created a minimal reproduction https://github.com/joequincy/quartz-spa-repro/commit/b64659214988e52f35ebcbb46de7e3a314569569 with two pages. Just run
npx quartz build --serve
on therepro
branch.Desktop (please complete the following information):
node
Version: 20.9.0npm
version: 10.8.1Additional context I have also found what appears to be the source of the issue, and produced a potential fix on my reproduction. https://github.com/joequincy/quartz-spa-repro/commit/36703feb9e2c121945281a4d6b9d3dafa5af8a87 is on a separate
potential-fix
branch for local testing.