From 660aae62e09ea1f5ec957149b78bfd01a85bd79f Mon Sep 17 00:00:00 2001
From: Odaimoko <934854676@qq.com>
Date: Tue, 28 Nov 2023 07:05:18 +0000
Subject: [PATCH] docs: add Imk&Cc's homepage to showcase.md (#595)
---
quartz/plugins/emitters/contentIndex.ts | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/quartz/plugins/emitters/contentIndex.ts b/quartz/plugins/emitters/contentIndex.ts
index 911173e..c5170c6 100644
--- a/quartz/plugins/emitters/contentIndex.ts
+++ b/quartz/plugins/emitters/contentIndex.ts
@@ -59,6 +59,17 @@
</item>`
const items = Array.from(idx)
+ .sort(([_, f1], [__, f2]) => {
+ if (f1.date && f2.date) {
+ return f2.date.getTime() - f1.date.getTime()
+ } else if (f1.date && !f2.date) {
+ return -1
+ } else if (!f1.date && f2.date) {
+ return 1
+ }
+
+ return f1.title.localeCompare(f2.title)
+ })
.map(([slug, content]) => createURLEntry(simplifySlug(slug), content))
.slice(0, limit ?? idx.size)
.join("")
@@ -68,9 +79,9 @@
<channel>
<title>${escapeHTML(cfg.pageTitle)}</title>
<link>${root}</link>
- <description>${!!limit ? `Last ${limit} notes` : "Recent notes"} on ${
- cfg.pageTitle
- }</description>
+ <description>${!!limit ? `Last ${limit} notes` : "Recent notes"} on ${escapeHTML(
+ cfg.pageTitle,
+ )}</description>
<generator>Quartz -- quartz.jzhao.xyz</generator>
${items}
</channel>
--
Gitblit v1.10.0