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

post categories are not clickable when new post folder name have space or not in English #11745

Closed
TonyFly3000 opened this issue Dec 27, 2024 · 14 comments · Fixed by #11869
Closed
Assignees
Labels
bug Something isn't working listings
Milestone

Comments

@TonyFly3000
Copy link

Bug description

quarto blog bug:

When new post folder name have space or not in English then the post categories are not clickable.

Image

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Your environment

No response

Quarto check output

Quarto 1.6.30
[✓] Checking environment information...
Quarto cache location: /Users/jinchaoduan/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.4.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.46.3: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.6.30
Path: /Applications/quarto/bin

[✓] Checking tools....................OK
TinyTeX: v2024.04
Chromium: (not installed)

[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/jinchaoduan/Library/TinyTeX/bin/universal-darwin
Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
Version: 3.13.0
Path: /Library/Frameworks/Python.framework/Versions/3.13/bin/python3
Jupyter: 5.7.2
Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
Version: 4.4.1
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
knitr: 1.48
rmarkdown: 2.28

[✓] Checking Knitr engine render......OK

@TonyFly3000 TonyFly3000 added the bug Something isn't working label Dec 27, 2024
@mcanouil
Copy link
Collaborator

mcanouil commented Dec 27, 2024

Unfortunately, we cannot use your report as you are talking about something but illustrated with something not relevant to your issue which appears to work properly.
Providing a clear depiction of an issue and the steps to reproduce is not optional, we do need that in order to help. Help us help you.

Note that you should enclose your categories with quotes.

Screen.Recording.2024-12-27.at.20.18.30.mov
Screen.Recording.2024-12-27.at.20.24.29.mov

@mcanouil mcanouil added the needs-repro Issues that are blocked until reporter provides an adequate reproduction label Dec 27, 2024
@TonyFly3000
Copy link
Author

Thanks for the reply. I added the video clip at the end. Three posts are the same. Only difference are the post folder names.

Image

So post categories are not clickable in the post page(not the main page) when new post folder name have space or not in English

screenshots.2.mp4

@mcanouil
Copy link
Collaborator

We need a reproducible example not a video of one.


You can share a self-contained "working" (reproducible) Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````).
See https://quarto.org/bug-reports.html#small-is-beautiful-aim-for-a-single-document-with-10-lines.

If you have multiple files (and if it is absolutely required to have multiple files), please share as a Git repository.

RPython
````qmd
---
title: "Reproducible Quarto Document"
format: html
engine: knitr
---

This is a reproducible Quarto document.

{{< lipsum 1 >}}

```{r}
x <- c(1, 2, 3, 4, 5)
y <- c(1, 4, 9, 16, 25)

plot(x, y)
```

![An image]({{< placeholder 600 400 >}}){#fig-placeholder}

{{< lipsum 1 >}}

The end after @fig-placeholder.
````
````qmd
---
title: "Reproducible Quarto Document"
format: html
engine: jupyter
---

This is a reproducible Quarto document.

{{< lipsum 1 >}}

```{python}
import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]

plt.plot(x, y)
plt.show()
```

![An image]({{< placeholder 600 400 >}}){#fig-placeholder}

{{< lipsum 1 >}}

The end after @fig-placeholder.
````

Additionally and if not already given, please share the output of quarto check within a code blocks (i.e., using three backticks ```txt), see https://quarto.org/bug-reports.html#check.

@TonyFly3000
Copy link
Author

There is the Git repository:https://github.com/TonyFly3000/testing-quarto-blog

Again the bug is
Post categories are not clickable in the post page(not the main page) when new post folder name have space or not in English

@dominicroye
Copy link

I have the same issue.

@mcanouil
Copy link
Collaborator

@TonyFly3000 The Git repository does not exist or is not public.

@TonyFly3000
Copy link
Author

sorry, Its public now

@mcanouil
Copy link
Collaborator

Thanks, I can reproduce with your repository.

@mcanouil mcanouil added listings and removed needs-repro Issues that are blocked until reporter provides an adequate reproduction labels Dec 29, 2024
@cderv
Copy link
Collaborator

cderv commented Jan 15, 2025

Please, try latest v1.6.40 version. This issue should have been fixed with the patches we've done.

Thanks

@cderv cderv added the verify-fixed Already fixed, awaiting verification from the issue reporter to confirm. label Jan 15, 2025
@cderv cderv added this to the v1.7 milestone Jan 15, 2025
@cderv cderv self-assigned this Jan 15, 2025
@cscheid
Copy link
Collaborator

cscheid commented Jan 15, 2025

I can repro as well on main.

@mcanouil
Copy link
Collaborator

The main issue here was the categories inside a post with non ascii characters or spaces in the filepath:

Screen.Recording.2025-01-15.at.15.14.28.mov

@mcanouil mcanouil removed the verify-fixed Already fixed, awaiting verification from the issue reporter to confirm. label Jan 15, 2025
@cderv
Copy link
Collaborator

cderv commented Jan 15, 2025

Ok other bug then. I'll have a look. Thanks !!

@cderv
Copy link
Collaborator

cderv commented Jan 15, 2025

Found the problem as we could expect.

We use window.location.pathname which return URL encoded path, and comparer it to non URL encoded, and so it prevent from activating the categories found in listing

async function findAndActivateCategories() {
// Categories search with listing only use path without query
const currentPagePath = offsetAbsoluteUrl(
window.location.origin + window.location.pathname
);
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 {
// See if the referrer is a listing page for this item
const referredRelativePath = offsetAbsoluteUrl(document.referrer);
const referrerListing = listingHrefs.find((listingHref) => {
const isListingReferrer =
listingHref === referredRelativePath ||
listingHref === referredRelativePath + "index.html";
return isListingReferrer;
});
if (referrerListing) {
// Try to use the referrer if possible
activateCategories(referrerListing);
} else if (listingHrefs.length > 0) {
// Otherwise, just fall back to the first listing
activateCategories(listingHrefs[0]);
}
}
});
}
}

I'll push a fix, and add new tests

@TonyFly3000
Copy link
Author

Thanks. The issue fix on main

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.

5 participants