From bf603c49c2edaa5fcbe42479421a336dcacf92b9 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sat, 11 Nov 2023 20:08:54 +0000
Subject: [PATCH] fix: sort rss feed by date
---
quartz/plugins/emitters/contentIndex.ts | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/quartz/plugins/emitters/contentIndex.ts b/quartz/plugins/emitters/contentIndex.ts
index 911173e..2c70368 100644
--- a/quartz/plugins/emitters/contentIndex.ts
+++ b/quartz/plugins/emitters/contentIndex.ts
@@ -6,6 +6,7 @@
import { QuartzEmitterPlugin } from "../types"
import { toHtml } from "hast-util-to-html"
import path from "path"
+import { byDateAndAlphabetical } from "../../components/PageList"
export type ContentIndex = Map<FullSlug, ContentDetails>
export type ContentDetails = {
@@ -59,6 +60,7 @@
</item>`
const items = Array.from(idx)
+ .sort((a, b) => byDateAndAlphabetical(cfg)(a[1], b[1]))
.map(([slug, content]) => createURLEntry(simplifySlug(slug), content))
.slice(0, limit ?? idx.size)
.join("")
@@ -68,9 +70,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