From bf603c49c2edaa5fcbe42479421a336dcacf92b9 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 11 Nov 2023 12:08:54 -0800 Subject: [PATCH] fix: sort rss feed by date --- quartz/plugins/emitters/contentIndex.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quartz/plugins/emitters/contentIndex.ts b/quartz/plugins/emitters/contentIndex.ts index 69d0d37..2c70368 100644 --- a/quartz/plugins/emitters/contentIndex.ts +++ b/quartz/plugins/emitters/contentIndex.ts @@ -6,6 +6,7 @@ import { FilePath, FullSlug, SimpleSlug, simplifySlug } from "../../util/path" import { QuartzEmitterPlugin } from "../types" import { toHtml } from "hast-util-to-html" import path from "path" +import { byDateAndAlphabetical } from "../../components/PageList" export type ContentIndex = Map export type ContentDetails = { @@ -59,6 +60,7 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: nu ` 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("")