-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't strip index.html from external links #11527
Comments
The piece of code you shared needs to be understood in the more generic context of this feature from #8853. The important part is links[i].dataset.originalHref = links[i].href This is used to store original href as indeed the following replace for everything link. But later this happens quarto-cli/src/resources/formats/html/templates/quarto-html.ejs Lines 368 to 376 in 88819d5
Any external non-navigation links will be "fixed" by putting back the original href. So for your example:
This seems definitely a problem but I don't think we expect Can you help with more context on where you find the issue with external link being incorrectly modified ? |
Also, attribution links for all other pages are also changed, for example: https://toknow.ai/posts/private-domain-checker/index.html has been changed to https://toknow.ai/posts/private-domain-checker/ . This particularly okay, but there should be a way to disable/override that behaviour. |
Thanks for sharing your website. For what I can see, you may be using something like
This is translated to
and so when trying to decide if You could use a regex in this config so that you match link starting with https://toknow.ai as internal and others as external. If I am right, this could help link-external-filter: '^(?:http:|https:)\/\/toknow\.ai\/' This would not match I think your special urls Hope this helps understand
Regarding this, stripping There was recently a related discussion on |
I don't have a Let me try |
Ok so this is probably the default applying using site-url: https://toknow.ai do you have that ? Otherwise, our last default is using windows.host Logic is in the EJS template we use quarto-cli/src/resources/formats/html/templates/quarto-html.ejs Lines 357 to 363 in 88819d5
and quarto-cli/src/format/html/format-html.ts Lines 300 to 312 in 88819d5
|
yes, I have |
after adding |
Bug description
This issue was previously reported at #8852 but was not actually resolved. A change was made at #8853
Simply,
/index.html
in the following link will be replaced, which is not okay.https://api.visitorbadge.io/api/visitors?path=https://github.com/index.html
The issue is still the same:
quarto-cli/src/resources/projects/website/navigation/quarto-nav.js
Line 277 in e29433f
There are two issues:
.replace(/\/index\.html/, "/")
replaces/index.html
anywhere in the link, not just the end of the stringconst links = window.document.querySelectorAll("a");
selects all links. It should probably avoid links with certain class, or attributes, eg:Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Your environment
No response
Quarto check output
The text was updated successfully, but these errors were encountered: