···30303131## Customization
32323333-The folder listings are a functionality of the [[FolderPage]] plugin, the tag listings of the [[TagPage]] plugin. See the plugin pages for customization options.
3333+Quartz allows you to define a custom sort ordering for content on both page types. The folder listings are a functionality of the [[FolderPage]] plugin, the tag listings of the [[TagPage]] plugin. See the plugin pages for customization options.
+4-2
docs/plugins/FolderPage.md
···1111> [!note]
1212> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
13131414-This plugin has no configuration options.
1414+The pages are displayed using the `defaultListPageLayout` in `quartz.layouts.ts`. For the content, the `FolderContent` component is used. If you want to modify the layout, you must edit it directly (`quartz/components/pages/FolderContent.tsx`).
15151616-The pages are displayed using the `defaultListPageLayout` in `quartz.layouts.ts`. For the content, the `FolderContent` component is used. If you want to modify the layout, you must edit it directly (`quartz/components/pages/FolderContent.tsx`).
1616+This plugin accepts the following configuration options:
1717+1818+- `sort`: A function of type `(f1: QuartzPluginData, f2: QuartzPluginData) => number{:ts}` used to sort entries. Defaults to sorting by date and tie-breaking on lexographical order.
17191820## API
1921
+4-2
docs/plugins/TagPage.md
···99> [!note]
1010> For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.
11111212-This plugin has no configuration options.
1212+The pages are displayed using the `defaultListPageLayout` in `quartz.layouts.ts`. For the content, the `TagContent` component is used. If you want to modify the layout, you must edit it directly (`quartz/components/pages/TagContent.tsx`).
13131414-The pages are displayed using the `defaultListPageLayout` in `quartz.layouts.ts`. For the content, the `TagContent` component is used. If you want to modify the layout, you must edit it directly (`quartz/components/pages/TagContent.tsx`).
1414+This plugin accepts the following configuration options:
1515+1616+- `sort`: A function of type `(f1: QuartzPluginData, f2: QuartzPluginData) => number{:ts}` used to sort entries. Defaults to sorting by date and tie-breaking on lexographical order.
15171618## API
1719
+4-4
quartz/components/PageList.tsx
···44import { QuartzComponent, QuartzComponentProps } from "./types"
55import { GlobalConfiguration } from "../cfg"
6677-export function byDateAndAlphabetical(
88- cfg: GlobalConfiguration,
99-): (f1: QuartzPluginData, f2: QuartzPluginData) => number {
77+export type SortFn = (f1: QuartzPluginData, f2: QuartzPluginData) => number
88+99+export function byDateAndAlphabetical(cfg: GlobalConfiguration): SortFn {
1010 return (f1, f2) => {
1111 if (f1.dates && f2.dates) {
1212 // sort descending
···27272828type Props = {
2929 limit?: number
3030- sort?: (f1: QuartzPluginData, f2: QuartzPluginData) => number
3030+ sort?: SortFn
3131} & QuartzComponentProps
32323333export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit, sort }: Props) => {
+2-3
quartz/components/pages/FolderContent.tsx
···22import path from "path"
3344import style from "../styles/listPage.scss"
55-import { PageList } from "../PageList"
55+import { PageList, SortFn } from "../PageList"
66import { stripSlashes, simplifySlug } from "../../util/path"
77import { Root } from "hast"
88import { htmlToJsx } from "../../util/jsx"
99import { i18n } from "../../i18n"
1010-import { QuartzPluginData } from "../../plugins/vfile"
11101211interface FolderContentOptions {
1312 /**
1413 * Whether to display number of folders
1514 */
1615 showFolderCount: boolean
1717- sort?: (f1: QuartzPluginData, f2: QuartzPluginData) => number
1616+ sort?: SortFn
1817}
19182019const defaultOptions: FolderContentOptions = {