Skip to content

Commit fe41d15

Browse files
PageList: sort by alphabetical only
Revert to sorting by alphabetical only, but include dates beside page names in Page Listings
1 parent d5ba45e commit fe41d15

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

quartz/components/PageList.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ export function byDateAndAlphabetical(
2525
}
2626
}
2727

28-
// export function byAlphabetical(
29-
// cfg: GlobalConfiguration,
30-
// ): (f1: QuartzPluginData, f2: QuartzPluginData) => number {
31-
// return (f1, f2) => {
32-
// // sort lexographically by title
33-
// const f1Title = f1.frontmatter?.title.toLowerCase() ?? ""
34-
// const f2Title = f2.frontmatter?.title.toLowerCase() ?? ""
35-
// return f1Title.localeCompare(f2Title)
36-
// }
37-
// }
28+
export function byAlphabetical(
29+
cfg: GlobalConfiguration,
30+
): (f1: QuartzPluginData, f2: QuartzPluginData) => number {
31+
return (f1, f2) => {
32+
// sort lexographically by title
33+
const f1Title = f1.frontmatter?.title.toLowerCase() ?? ""
34+
const f2Title = f2.frontmatter?.title.toLowerCase() ?? ""
35+
return f1Title.localeCompare(f2Title)
36+
}
37+
}
3838

3939
type Props = {
4040
limit?: number
4141
sort?: (f1: QuartzPluginData, f2: QuartzPluginData) => number
4242
} & QuartzComponentProps
4343

4444
export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit, sort }: Props) => {
45-
const sorter = sort ?? byDateAndAlphabetical(cfg)
45+
const sorter = sort ?? byAlphabetical(cfg)
4646
let list = allFiles.sort(sorter)
4747
if (limit) {
4848
list = list.slice(0, limit)

0 commit comments

Comments
 (0)