From 84ff4012d10df599df23bfebadfd5ab5b31945c3 Mon Sep 17 00:00:00 2001 From: Suryaansh Rai Date: Sat, 17 Jan 2026 22:47:01 +0530 Subject: [PATCH] fix: deduplication and slugiication of tags based on copilot's review --- quartz/plugins/emitters/contentIndex.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/quartz/plugins/emitters/contentIndex.tsx b/quartz/plugins/emitters/contentIndex.tsx index 6ffc96ed4..cac738677 100644 --- a/quartz/plugins/emitters/contentIndex.tsx +++ b/quartz/plugins/emitters/contentIndex.tsx @@ -9,6 +9,7 @@ import { getAllSegmentPrefixes, joinSegments, simplifySlug, + slugTag, } from "../../util/path" import { QuartzEmitterPlugin } from "../types" import { toHtml } from "hast-util-to-html" @@ -153,6 +154,9 @@ export const ContentIndex: QuartzEmitterPlugin> = (opts) => { let sortedTags: string[] = [] if (opts.rssTags && opts.rssTags.length > 0) { + // Deduplicate and slugify user-provided tags + const userTags = new Set(opts.rssTags.map((tag) => slugTag(tag))) + // Only include user-specified tags that actually exist in the content const availableTags = new Set() for (const [_, content] of linkIndex) { @@ -161,7 +165,7 @@ export const ContentIndex: QuartzEmitterPlugin> = (opts) => { availableTags.add(tag) } } - sortedTags = opts.rssTags.filter((tag) => availableTags.has(tag)) + sortedTags = Array.from(userTags).filter((tag) => availableTags.has(tag)) } else if ((opts.rssTagsLimit ?? 0) > 0) { const tagCounts: Map = new Map()