Skip to content

Commit 427994e

Browse files
Fix: page modified dates are incorrect
Edits to `quartz.config.ts` and [CreatedModifiedDate](https://quartz.jzhao.xyz/plugins/CreatedModifiedDate) plugin to hopefully fix page modified dates being incorrect (they show date of last site build, rather than individual file modified dates)
1 parent 0599491 commit 427994e

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

quartz.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const config: QuartzConfig = {
1717
locale: "en-US",
1818
baseUrl: "morrowind-modding.github.io",
1919
ignorePatterns: ["private", "**/templates/", ".obsidian"],
20-
defaultDateType: "created",
20+
defaultDateType: "modified",
2121
theme: {
2222
fontOrigin: "googleFonts",
2323
cdnCaching: true,
@@ -56,7 +56,7 @@ const config: QuartzConfig = {
5656
transformers: [
5757
Plugin.FrontMatter(),
5858
Plugin.CreatedModifiedDate({
59-
priority: ["frontmatter", "filesystem"],
59+
priority: ["git", "frontmatter", "filesystem"],
6060
}),
6161
Plugin.SyntaxHighlighting({
6262
theme: {

quartz/components/PageList.tsx

+13-12
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 ?? byAlphabetical(cfg)
45+
const sorter = sort ?? byDateAndAlphabetical(cfg)
4646
let list = allFiles.sort(sorter)
4747
if (limit) {
4848
list = list.slice(0, limit)
@@ -60,7 +60,8 @@ export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit, sort
6060
<div class="section">
6161
<div>
6262
{page.dates && (
63-
<p>
63+
<p class="meta">
64+
<Date date={getDate(cfg, page)!} locale={cfg.locale} />
6465
</p>
6566
)}
6667
</div>

0 commit comments

Comments
 (0)