Update quartz.layout.ts

开启了tag显示,限制笔记数量为4条,过滤规则为排除掉以index.md结尾的文件(即首页或文件夹主页),并编写了一条自定义排序规则
This commit is contained in:
wangzipai 2024-10-30 10:19:02 +08:00 committed by GitHub
parent aaf846ab11
commit dde4656b6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,7 +27,31 @@ export const defaultContentPageLayout: PageLayout = {
Component.MobileOnly(Component.Spacer()),
Component.Search(),
Component.Darkmode(),
Component.DesktopOnly(Component.Explorer()),
Component.DesktopOnly(
Component.RecentNotes({
title: "最近更新",
showTags: true,
limit: 4,
filter: (f) => {
if (f.filePath?.endsWith("index.md")) {
return false
}
return true
},
sort: (f1, f2) => {
if (f1.dates && f2.dates) {
if (Math.abs(f2.dates.modified.getDay() - f1.dates.modified.getDay())<=3) {
return f2.dates.created.getTime() - f1.dates.created.getTime()
}
return f2.dates.modified.getTime() - f1.dates.modified.getTime()
} else if (f1.dates && !f2.dates) {
return -1
}
return 1
}
})
),
Component.DesktopOnly(Component.TableOfContents()),
],
right: [
Component.Graph(),