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:
		@@ -114,6 +114,10 @@ export const FrontMatter: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (socialImage) data.socialImage = socialImage
 | 
					            if (socialImage) data.socialImage = socialImage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Remove duplicate slugs
 | 
				
			||||||
 | 
					            const uniqueSlugs = [...new Set(allSlugs)]
 | 
				
			||||||
 | 
					            allSlugs.splice(0, allSlugs.length, ...uniqueSlugs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // fill in frontmatter
 | 
					            // fill in frontmatter
 | 
				
			||||||
            file.data.frontmatter = data as QuartzPluginData["frontmatter"]
 | 
					            file.data.frontmatter = data as QuartzPluginData["frontmatter"]
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user