diff --git a/news/changelog-1.6.md b/news/changelog-1.6.md index f1756e6d1c..ed389e9758 100644 --- a/news/changelog-1.6.md +++ b/news/changelog-1.6.md @@ -44,6 +44,10 @@ All changes included in 1.6: - ([#10268](https://github.com/quarto-dev/quarto-cli/issues/10268)]): `quarto create` supports opening project in Positron, in addition to VS Code and RStudio IDE. +## Quarto Blog + +- ([#10710](https://github.com/quarto-dev/quarto-cli/issues/10710)): Fix an issue with categorie badges as links in the blog post header. + ## Engines ### `julia` diff --git a/src/resources/formats/html/quarto.js b/src/resources/formats/html/quarto.js index 39e6869927..3c24c295ff 100644 --- a/src/resources/formats/html/quarto.js +++ b/src/resources/formats/html/quarto.js @@ -225,7 +225,10 @@ window.document.addEventListener("DOMContentLoaded", function (_event) { } async function findAndActivateCategories() { - const currentPagePath = offsetAbsoluteUrl(window.location.href); + // 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) { diff --git a/tests/docs/playwright/blog/listing-search/.gitignore b/tests/docs/playwright/blog/simple-blog/.gitignore similarity index 100% rename from tests/docs/playwright/blog/listing-search/.gitignore rename to tests/docs/playwright/blog/simple-blog/.gitignore diff --git a/tests/docs/playwright/blog/listing-search/_quarto.yml b/tests/docs/playwright/blog/simple-blog/_quarto.yml similarity index 100% rename from tests/docs/playwright/blog/listing-search/_quarto.yml rename to tests/docs/playwright/blog/simple-blog/_quarto.yml diff --git a/tests/docs/playwright/blog/listing-search/index.qmd b/tests/docs/playwright/blog/simple-blog/index.qmd similarity index 100% rename from tests/docs/playwright/blog/listing-search/index.qmd rename to tests/docs/playwright/blog/simple-blog/index.qmd diff --git a/tests/docs/playwright/blog/listing-search/posts/_metadata.yml b/tests/docs/playwright/blog/simple-blog/posts/_metadata.yml similarity index 100% rename from tests/docs/playwright/blog/listing-search/posts/_metadata.yml rename to tests/docs/playwright/blog/simple-blog/posts/_metadata.yml diff --git a/tests/docs/playwright/blog/listing-search/posts/post-with-code/image.jpg b/tests/docs/playwright/blog/simple-blog/posts/post-with-code/image.jpg similarity index 100% rename from tests/docs/playwright/blog/listing-search/posts/post-with-code/image.jpg rename to tests/docs/playwright/blog/simple-blog/posts/post-with-code/image.jpg diff --git a/tests/docs/playwright/blog/listing-search/posts/post-with-code/index.qmd b/tests/docs/playwright/blog/simple-blog/posts/post-with-code/index.qmd similarity index 100% rename from tests/docs/playwright/blog/listing-search/posts/post-with-code/index.qmd rename to tests/docs/playwright/blog/simple-blog/posts/post-with-code/index.qmd diff --git a/tests/docs/playwright/blog/listing-search/posts/welcome/index.qmd b/tests/docs/playwright/blog/simple-blog/posts/welcome/index.qmd similarity index 89% rename from tests/docs/playwright/blog/listing-search/posts/welcome/index.qmd rename to tests/docs/playwright/blog/simple-blog/posts/welcome/index.qmd index 597353245e..b8cb583f96 100644 --- a/tests/docs/playwright/blog/listing-search/posts/welcome/index.qmd +++ b/tests/docs/playwright/blog/simple-blog/posts/welcome/index.qmd @@ -9,4 +9,6 @@ This is the first post in a Quarto blog. Welcome! ![](thumbnail.jpg) +## About image listing {#img-lst} + Since this post doesn't specify an explicit `image`, the first image in the post will be used in the listing page of posts. diff --git a/tests/docs/playwright/blog/listing-search/posts/welcome/thumbnail.jpg b/tests/docs/playwright/blog/simple-blog/posts/welcome/thumbnail.jpg similarity index 100% rename from tests/docs/playwright/blog/listing-search/posts/welcome/thumbnail.jpg rename to tests/docs/playwright/blog/simple-blog/posts/welcome/thumbnail.jpg diff --git a/tests/integration/playwright/tests/blog-listing-search.spec.ts b/tests/integration/playwright/tests/blog-simple-blog.spec.ts similarity index 62% rename from tests/integration/playwright/tests/blog-listing-search.spec.ts rename to tests/integration/playwright/tests/blog-simple-blog.spec.ts index 86c4d18184..2de55c2858 100644 --- a/tests/integration/playwright/tests/blog-listing-search.spec.ts +++ b/tests/integration/playwright/tests/blog-simple-blog.spec.ts @@ -4,7 +4,7 @@ import { getUrl } from "../src/utils.js"; test('List.js is correctly patch to allow searching with lowercase and uppercase', async ({ page }) => { - await page.goto(getUrl('blog/listing-search/_site/')); + await page.goto(getUrl('blog/simple-blog/_site/')); await page.getByPlaceholder('Filter').click(); await page.getByPlaceholder('Filter').fill('Code'); await page.getByPlaceholder('Filter').press('Enter'); @@ -21,3 +21,14 @@ test('List.js is correctly patch to allow searching with lowercase and uppercase await expect(page.getByRole('link', { name: 'Post With Code' })).toBeVisible(); await expect(page.getByRole('link', { name: 'Welcome To My Blog' })).toBeHidden(); }); + +test('Categories link are clickable', async ({ page }) => { + await page.goto(getUrl('blog/simple-blog/_site/posts/welcome/')); + await page.locator('div').filter({ hasText: /^news$/ }).click(); + await expect(page).toHaveURL(/_site\/index\.html#category=news$/); + await expect(page.locator('div.category[data-category="news"]')).toHaveClass(/active/); + await page.goto(getUrl('blog/simple-blog/_site/posts/welcome/#img-lst')); + await page.locator('div').filter({ hasText: /^news$/ }).click(); + await expect(page).toHaveURL(/_site\/index\.html#category=news$/); + await expect(page.locator('div.category[data-category="news"]')).toHaveClass(/active/); +}); \ No newline at end of file