Skip to content
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

blog output: tag links don't work from pages called with an anchor URL #10710

Closed
aborruso opened this issue Sep 4, 2024 · 11 comments · Fixed by #10712
Closed

blog output: tag links don't work from pages called with an anchor URL #10710

aborruso opened this issue Sep 4, 2024 · 11 comments · Fixed by #10712
Assignees
Labels
bug Something isn't working listings
Milestone

Comments

@aborruso
Copy link
Contributor

aborruso commented Sep 4, 2024

Bug description

If I open this URL this URL that contains an anchor

https://quarto.org/docs/blog/posts/2024-07-02-beautiful-tables-in-typst/#cars-heatmap-gt-r

the links of the page tags does not work, the links are not active

image

Steps to reproduce

Expected behavior

To have the tag links work

Actual behavior

The tag links not work

Your environment

The env used for quarto website

Quarto check output

The output of quarto website

@aborruso aborruso added the bug Something isn't working label Sep 4, 2024
@mcanouil
Copy link
Collaborator

mcanouil commented Sep 4, 2024

The output of quarto website

That is not the output of quarto check
Could you provide the quarto check output as requested in the template?

The env used for quarto website

That is not your environment.
Please do read properly the issue template.
We expect your environment such as your operating system, etc.

@aborruso
Copy link
Contributor Author

aborruso commented Sep 4, 2024

@mcanouil I reproduced the user experience, it is the blog of the repository of the quarto official website.
For this reason I did not include what was requested in the template.

This is the repo https://github.com/quarto-dev/quarto-web

Should I download the repo locally, render and see if it doesn't work locally by me as well? I don't think so, I think what you see online may be enough.

Thank you always

@mcanouil
Copy link
Collaborator

mcanouil commented Sep 4, 2024

It's not about the reproducible example or not really.
It's really about your environment which is not the one used for Quarto website.
And we have no idea which Quarto and dependencies you are using.

@mcanouil
Copy link
Collaborator

mcanouil commented Sep 4, 2024

It seems you are commenting on a rendered page, but did you reproduce the error? Possibly with a simple example rather that a website/repository as big as Quarto documentation.

FYI, I do reproduce the website issue, including prelease.
https://prerelease.quarto.org/docs/blog/posts/2024-07-02-beautiful-tables-in-typst/#cars-heatmap-gt-r

@aborruso
Copy link
Contributor Author

aborruso commented Sep 4, 2024

Thank you, I close it and open again in the repo of website

@aborruso aborruso closed this as completed Sep 4, 2024
@cderv
Copy link
Collaborator

cderv commented Sep 4, 2024

This is fine here. Let's not duplicate on the other side.

@cderv cderv reopened this Sep 4, 2024
@cderv
Copy link
Collaborator

cderv commented Sep 4, 2024

Problem is in quarto.js. The link processing does not account for anchor part in url

async function findAndActivateCategories() {
const currentPagePath = offsetAbsoluteUrl(window.location.href);
const response = await fetch(offsetRelativeUrl("listings.json"));
if (response.status == 200) {
return response.json().then(function (listingPaths) {
const listingHrefs = [];
for (const listingPath of listingPaths) {
const pathWithoutLeadingSlash = listingPath.listing.substring(1);
for (const item of listingPath.items) {
if (
item === currentPagePath ||
item === currentPagePath + "index.html"
) {
// Resolve this path against the offset to be sure
// we already are using the correct path to the listing
// (this adjusts the listing urls to be rooted against
// whatever root the page is actually running against)
const relative = offsetRelativeUrl(pathWithoutLeadingSlash);
const baseUrl = window.location;
const resolvedPath = new URL(relative, baseUrl);
listingHrefs.push(resolvedPath.pathname);
break;
}
}
}
// Look up the tree for a nearby linting and use that if we find one
const nearestListing = findNearestParentListing(
offsetAbsoluteUrl(window.location.pathname),
listingHrefs
);
if (nearestListing) {
activateCategories(nearestListing);
} else {

We'll fix this.

@cderv cderv added the listings label Sep 4, 2024
@cderv cderv self-assigned this Sep 4, 2024
@cderv cderv added this to the v1.6 milestone Sep 4, 2024
@mcanouil
Copy link
Collaborator

mcanouil commented Sep 4, 2024

Thank you, I close it and open again in the repo of website

That's not what I meant. I meant you seem to report an issue on the website that you did not reproduce using a simple reproducible example with Quarto CLI.

@aborruso
Copy link
Contributor Author

aborruso commented Sep 4, 2024

@cderv I also seemed fine here.It was a special case in my opinion, well described, so it didn't make sense to put those two parts of the template. But maybe I'm wrong.

Anyway, thank you very much to you and @mcanouil

@aborruso
Copy link
Contributor Author

aborruso commented Sep 4, 2024

And I'm glad I was helpful. Unfortunately, I don't know how to correct the code

@cderv
Copy link
Collaborator

cderv commented Sep 4, 2024

Yes thanks for the report. We'll handle it from here.

It was a special case in my opinion, well described, so it didn't make sense to put those two parts of the template. But maybe I'm wrong.

FWIW I agree with you, it was descriptive enough and reproducible with the website so we can find the issue. This is special case is usually true for JS code part that runs in browser. If is applies on website, then it will most of the time impact our quarto website.

Thank you, this is enough for me to go fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working listings
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants