rebase: a20110

This commit is contained in:
bfahrenfort 2025-03-06 08:02:21 -06:00
parent c65e6836b4
commit 5ca088bb44

View File

@ -40,7 +40,7 @@ interface Options {
bypassIndexCheck: boolean bypassIndexCheck: boolean
rssLimit?: number rssLimit?: number
rssFullHtml: boolean rssFullHtml: boolean
rssSlug: FullSlug rssSlug: string
includeEmptyFiles: boolean includeEmptyFiles: boolean
titlePattern?: (cfg: GlobalConfiguration, dir: FullSlug, dirIndex?: ContentDetails) => string titlePattern?: (cfg: GlobalConfiguration, dir: FullSlug, dirIndex?: ContentDetails) => string
} }
@ -51,7 +51,7 @@ const defaultOptions: Options = {
enableRSS: true, enableRSS: true,
rssLimit: 10, rssLimit: 10,
rssFullHtml: false, rssFullHtml: false,
rssSlug: "index" as FullSlug, rssSlug: "index",
includeEmptyFiles: true, includeEmptyFiles: true,
titlePattern: (cfg, dir, dirIndex) => titlePattern: (cfg, dir, dirIndex) =>
`${cfg.pageTitle} - ${dirIndex != null ? dirIndex.title : dir.split("/").pop()}`, `${cfg.pageTitle} - ${dirIndex != null ? dirIndex.title : dir.split("/").pop()}`,
@ -240,14 +240,27 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
feedTree.acceptPostorder(new FeedGenerator(ctx, cfg, opts, emitted)) feedTree.acceptPostorder(new FeedGenerator(ctx, cfg, opts, emitted))
// Generate index feed separately re-using the Entry[] composed upwards // Generate index feed separately re-using the Entry[] composed upwards
let topFeed = finishRSSFeed(cfg, opts, feedTree.data as Feed)
emitted.push( emitted.push(
write({ write({
ctx, ctx,
content: finishRSSFeed(cfg, opts, feedTree.data as Feed), content: topFeed,
slug: opts.rssSlug!, // Safety: defaults to "index" slug: opts.rssSlug! as FullSlug, // Safety: defaults to "index"
ext: ".xml", ext: ".xml",
}), }),
) )
// Reader compatibility, don't break existing readers if the path changes
if (opts.rssSlug !== defaultOptions.rssSlug) {
emitted.push(
write({
ctx,
content: topFeed,
slug: "index" as FullSlug,
ext: ".xml",
}),
)
}
} }
// Generate ContentIndex // Generate ContentIndex