Skip to content

Commit 11ffb94

Browse files
authored
Merge pull request #12425 from quarto-dev/bugfix/issue-8238
websites - sort categories case-insensitively
2 parents 3797761 + f043f9b commit 11ffb94

File tree

9 files changed

+76
-2
lines changed

9 files changed

+76
-2
lines changed

news/changelog-1.7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ All changes included in 1.7:
2828

2929
## Website projects
3030

31+
- ([#8238](https://github.com/quarto-dev/quarto-cli/issues/8238)): Listing categories are now sorted case-insensitively.
3132
- ([#11701](https://github.com/quarto-dev/quarto-cli/issues/11701)): Wrap HTML emitted by EJS templates in `{=html}` blocks to avoid memory blowup issues with Pandoc's parser.
3233
- ([#12134](https://github.com/quarto-dev/quarto-cli/issues/12134)): Forward `logo.small` images in `_brand.yml` files to a website `favicon`.
3334

src/project/types/website/listing/website-listing-categories.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* website-listing-categories.ts
33
*
4-
* Copyright (C) 2020-2022 Posit Software, PBC
4+
* Copyright (C) 2020-2025 Posit Software, PBC
55
*/
66
import { Document } from "deno_dom/deno-dom-wasm-noinit.ts";
77
import {
@@ -72,7 +72,11 @@ export function categorySidebar(
7272
categoriesEl.appendChild(allEl);
7373
}
7474

75-
for (const cat of Object.keys(cats).sort()) {
75+
for (
76+
const cat of Object.keys(cats).sort((a: string, b: string) =>
77+
a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())
78+
)
79+
) {
7680
const count = cats[cat];
7781
const catEl = categoryElement(doc, cat, formatFn(cat, count), cat);
7882
categoriesEl.appendChild(catEl);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.quarto/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "issue-8238"
6+
navbar:
7+
left:
8+
- href: index.qmd
9+
text: Home
10+
- about.qmd
11+
12+
format:
13+
html:
14+
theme:
15+
- cosmo
16+
- brand
17+
css: styles.css
18+
toc: true
19+
20+
21+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "About"
3+
---
4+
5+
About this site
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: "issue-8238"
3+
listing:
4+
- id: reports
5+
contents: "lab-reports"
6+
type: table
7+
fields: [title, author, reading-time]
8+
categories: true
9+
_quarto:
10+
render-project: true
11+
tests:
12+
html:
13+
ensureHtmlElements:
14+
- ['div.quarto-listing-category div.category:nth-child(2)[data-category="YWFyZHZhcms="]']
15+
- []
16+
---
17+
18+
This is a Quarto website.
19+
20+
To learn more about Quarto websites visit <https://quarto.org/docs/websites>.
21+
22+
## Reports
23+
24+
:::{#reports}
25+
:::
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Aardvark
3+
author: Anthony
4+
categories:
5+
- aardvark
6+
---
7+
8+
## It starts with aardvarks
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Zebra
3+
author: Zack
4+
categories:
5+
- Zebra
6+
---
7+
8+
## It ends with Zebras
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* css styles */

0 commit comments

Comments
 (0)