-
Notifications
You must be signed in to change notification settings - Fork 284
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
fix: remove trailing / from site-url and ensure canonical gets one #9595
Conversation
(Note the failing tests.) |
This suggestion doesn't work. Use the following as a test: _quarto.ymlproject:
type: website
canonical-url: true
website:
site-url: https://index.html.com/
title: "Test-9595"
navbar:
left:
- href: index.qmd
text: Home
- about.qmd
format:
html:
theme: cosmo
css: styles.css
toc: true You'll see that about.html gets a broken canonical URL:
|
Weird, as I don't get this result using this current PR with the two additional commits. FYI, I am using https://github.com/mcanouil/quarto-issues-experiments/tree/main/quarto-cli-9524 |
I've still got an issue though but not for index related files. |
The later commits fixed it. |
I'd like some unit or smoke tests here. Can you create a website project under 2024/05/06, configure it like above, and then test the contents of index.qmd and about.qmd? You can use |
I'll add the test probably on wednesday (I was going through the smoke tests to find a "template"). |
|
I don't understand why the tests are failing for subdirectories but not for root documents. |
I think this is just because our smoke all testing don't support this organization for projects. Your current test project is not something that See the path in error log
You see that the path created as output for the file to test is wrong, so you get the This is because we don't support subdirectory in project we tests in smoke-all Lines 89 to 94 in 3b4cdd3
We build the path without accounting for possibly subdirectories for the input. So two solutions:
Hope it helps understand |
@mcanouil Responding to #9524 (comment) here since it's more relevant: The test suite still isn't passing, right? |
Yes, because website project subdirectories does not meet test setup workflow as explained by Christophe. (Also did not had time to look in other testing workflows since I came back from my holidays) Edit: Manual inspection shows proper URLs. Root files are successfully passing the tests. The same tests for subdirectories fail. |
Let me try to adapt the test here. |
So I have done the work in an other PR: When this is merged, the test here should pass, possibly without change as it will now behave as expected. |
Should just be a matter of merging this against main in the PR branch, then, so the test suite runs with the new changes? |
@mcanouil All test have passed now. So this should be good. PR is draft - did you get anything to do before we merge ? |
I put it in draft because of the failing tests, so ready it is since the changes were made in |
I'll rebase and merge. Thanks ! |
This pull request fixes the issue where a trailing slash was not being removed from the site URL. The
synthesizeCitationUrl
function now removes the trailing slash from the base URL before constructing the citation URL.Outdated
I did not change the "else" part because I was unsure how to trigger this part of the codepath, but using the same if/else condition on length would not hurt I believe.
Fixes #9524