Skip to content

Commit

Permalink
fix: sort rss feed by date
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Nov 11, 2023
1 parent f67356c commit bf603c4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions quartz/plugins/emitters/contentIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<FullSlug, ContentDetails>
export type ContentDetails = {
Expand Down Expand Up @@ -59,6 +60,7 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: nu
</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("")
Expand Down

0 comments on commit bf603c4

Please sign in to comment.