File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 getAllSegmentPrefixes ,
1010 joinSegments ,
1111 simplifySlug ,
12+ slugTag ,
1213} from "../../util/path"
1314import { QuartzEmitterPlugin } from "../types"
1415import { toHtml } from "hast-util-to-html"
@@ -153,6 +154,9 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
153154 let sortedTags : string [ ] = [ ]
154155
155156 if ( opts . rssTags && opts . rssTags . length > 0 ) {
157+ // Deduplicate and slugify user-provided tags
158+ const userTags = new Set ( opts . rssTags . map ( ( tag ) => slugTag ( tag ) ) )
159+
156160 // Only include user-specified tags that actually exist in the content
157161 const availableTags = new Set < string > ( )
158162 for ( const [ _ , content ] of linkIndex ) {
@@ -161,7 +165,7 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
161165 availableTags . add ( tag )
162166 }
163167 }
164- sortedTags = opts . rssTags . filter ( ( tag ) => availableTags . has ( tag ) )
168+ sortedTags = Array . from ( userTags ) . filter ( ( tag ) => availableTags . has ( tag ) )
165169 } else if ( ( opts . rssTagsLimit ?? 0 ) > 0 ) {
166170 const tagCounts : Map < string , number > = new Map ( )
167171
You can’t perform that action at this time.
0 commit comments