You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 like
...
aliases:
- index
This allows me to have a content/ file structure like
content/
chapters/
chapter-1-name.md <--(this is aliased to index)
chapter-2-name.md
...
main-title-of-content.md <--(this is aliased to index)
other-arbitrary.md
metadata-pages.md
However 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 using minimorph 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:
Ensure quartz.config.ts has enableSPA: true
Have a content/ root without index.md
Add a file (e.g. faux-index.md) with frontmatter containing aliases: [index] (or multiline version)
Add a file to a subdirectory (e.g. demo/child-page.md)
Start local server with npx quartz build --serve
Visit the child page in your browser, then click the "Home" breadcrumb
Expected behavior
Quartz navigates to the aliased content at the unnested path.
Screenshots and Source
I have created a minimal reproduction joequincy/quartz-spa-repro@b646592 with two pages. Just run npx quartz build --serve on the repro branch.
Desktop (please complete the following information):
Quartz Version: 4.2.3
node Version: 20.9.0
npm version: 10.8.1
OS: Ubuntu (via Windows 11 WSL2)
Browser: Chrome
Additional context
I have also found what appears to be the source of the issue, and produced a potential fix on my reproduction. joequincy/quartz-spa-repro@36703fe is on a separate potential-fix branch for local testing.
The text was updated successfully, but these errors were encountered:
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 joequincy/quartz-spa-repro@b646592 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. joequincy/quartz-spa-repro@36703fe is on a separate
potential-fix
branch for local testing.The text was updated successfully, but these errors were encountered: