fix(frontmatter): prevent slug duplication through frontmatter (#1860)
* fix(frontmatter): prevent slug duplication through frontmatter * Simplify duplicate slug checks * Update quartz/plugins/transformers/frontmatter.ts Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com> * lint --------- Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>
This commit is contained in:
parent
3ce6aa49bf
commit
457b77dd48
1 changed files with 4 additions and 0 deletions
|
@ -114,6 +114,10 @@ export const FrontMatter: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
|
|||
|
||||
if (socialImage) data.socialImage = socialImage
|
||||
|
||||
// Remove duplicate slugs
|
||||
const uniqueSlugs = [...new Set(allSlugs)]
|
||||
allSlugs.splice(0, allSlugs.length, ...uniqueSlugs)
|
||||
|
||||
// fill in frontmatter
|
||||
file.data.frontmatter = data as QuartzPluginData["frontmatter"]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue