From c6f10b44f6878e76a416332f14e3681de8df40db Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Thu, 6 Mar 2025 00:54:11 +0100 Subject: [PATCH] feat(rss): configurable RSS feed URL (#1806) * feat(rss): configurable RSS feed URL * Update docs/features/RSS Feed.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update docs/features/RSS Feed.md --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Jacky Zhao --- docs/features/RSS Feed.md | 5 +++++ docs/plugins/ContentIndex.md | 1 + quartz/plugins/emitters/contentIndex.ts | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/features/RSS Feed.md b/docs/features/RSS Feed.md index ed4138d..4b1a1bb 100644 --- a/docs/features/RSS Feed.md +++ b/docs/features/RSS Feed.md @@ -1,5 +1,10 @@ Quartz emits an RSS feed for all the content on your site by generating an `index.xml` file that RSS readers can subscribe to. Because of the RSS spec, this requires the `baseUrl` property in your [[configuration]] to be set properly for RSS readers to pick it up properly. +> [!info] +> After deploying, the generated RSS link will be available at `https://${baseUrl}/index.xml` by default. +> +> The `index.xml` path can be customized by passing the `rssSlug` option to the [[ContentIndex]] plugin. + ## Configuration This functionality is provided by the [[ContentIndex]] plugin. See the plugin page for customization options. diff --git a/docs/plugins/ContentIndex.md b/docs/plugins/ContentIndex.md index eb7265d..037f723 100644 --- a/docs/plugins/ContentIndex.md +++ b/docs/plugins/ContentIndex.md @@ -17,6 +17,7 @@ This plugin accepts the following configuration options: - `enableRSS`: If `true` (default), produces an RSS feed (`index.xml`) with recent content updates. - `rssLimit`: Defines the maximum number of entries to include in the RSS feed, helping to focus on the most recent or relevant content. Defaults to `10`. - `rssFullHtml`: If `true`, the RSS feed includes full HTML content. Otherwise it includes just summaries. +- `rssSlug`: Slug to the generated RSS feed XML file. Defaults to `"index"`. - `includeEmptyFiles`: If `true` (default), content files with no body text are included in the generated index and resources. ## API diff --git a/quartz/plugins/emitters/contentIndex.ts b/quartz/plugins/emitters/contentIndex.ts index c0fef86..f4a1a91 100644 --- a/quartz/plugins/emitters/contentIndex.ts +++ b/quartz/plugins/emitters/contentIndex.ts @@ -25,6 +25,7 @@ interface Options { enableRSS: boolean rssLimit?: number rssFullHtml: boolean + rssSlug: string includeEmptyFiles: boolean } @@ -33,6 +34,7 @@ const defaultOptions: Options = { enableRSS: true, rssLimit: 10, rssFullHtml: false, + rssSlug: "index", includeEmptyFiles: true, } @@ -151,7 +153,7 @@ export const ContentIndex: QuartzEmitterPlugin> = (opts) => { await write({ ctx, content: generateRSSFeed(cfg, linkIndex, opts.rssLimit), - slug: "index" as FullSlug, + slug: (opts?.rssSlug ?? "index") as FullSlug, ext: ".xml", }), )