Open emberwick opened 1 month ago
I cannot reproduce using latest Quarto version. Please upgrade at least to 1.5.55 and report if you still have the issue.
Using latest development version: https://github.com/user-attachments/assets/6f187d77-2f05-4b64-b64b-09851a3ac653
The issue persists. The problem does not appear when previewing sites, only when opening the rendered file "_site/about.html" in a browser. See attached screenshot, which shows where the link is missing the host.
That's not a bug. It's how website works.
The _site content is supposed to be at the root of a web server.
Using file protocol is not the same thing. File protocol does not support some JavaScript, etc.
quarto preview
starts a web server.
I understand that's how it should work. But when "_site/about.html" is opened in firefox or chrome, the non-working button tries to go to "file:///index.html". The working link (for this example, which is a local site, obviously would be the host url if online) links to file:///path_to_project/_site/index.html.
The problem is that in about.html, the working link has <a href="./index.html">A link to index that does work</a>
and the non-working link has <a href="/index.html" class="about-link" rel="" target="">
. I do not know why quarto preview behaves differently in this situation.
If I manually change the absolute path in about.html to the relative path ./index.html
the link works properly on a page in firefox. I believe this is related to changes made between 1.4 and 1.5, as discussed here: https://github.com/quarto-dev/quarto-cli/issues/7329.
FYI, this is done for several links in menu/sidebar/etc which as a default to consider path as being absolute which seems to be the proper assumption in website.
Funnily, the function is mostly used across the codebase with absolute = false
except in rare places.
From
It's possible to set:
const resolved = await resolveInputTarget(
project,
pathWithForwardSlashes(href),
false,
);
But the function is used for several navigation components as said (navbar, sidebar).
The above suggestion works for simple website but further testing is required as it could break other links.
file:///
Quarto's files are not meant to be consumed with the file://
scheme, and a number of features will not work. I quite strongly recommend you use a web server (python -m http.serve
should be available for you on a Mac)
Bug description
When using one of the built-in "About" templates, internal links (to pages or files) are broken and result in the message "can’t find the file at /index.html." It appears that the host url does not get properly inserted.
Steps to reproduce
Make a Quarto website using the built-in RStudio template and edit the file
about.qmd
to read:A link to index that does work
Quarto 1.4.554 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.11: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.4.554 Path: /Applications/quarto/bin
[✓] Checking tools....................OK TinyTeX: (external install) Chromium: (not installed)
[✓] Checking LaTeX....................OK Using: TinyTex Path: /Users/elissa/Library/TinyTeX/bin/universal-darwin Version: 2024
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK Version: 3.11.7 Path: /opt/homebrew/opt/python@3.11/bin/python3.11 Jupyter: 5.7.1 Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK Version: 4.4.1 Path: /Library/Frameworks/R.framework/Resources LibPaths:
[✓] Checking Knitr engine render......OK