mirror of
				https://github.com/jackyzha0/quartz.git
				synced 2025-11-04 15:19:48 +01:00 
			
		
		
		
	fix(frontmatter): prevent slug duplication through frontmatter (#1860)
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
				
			
		
			
				
	
				Build and Test / publish-tag (push) Has been skipped
				
			
		
			
				
	
				Build and Test / build-and-test (macos-latest) (push) Has been cancelled
				
			
		
			
				
	
				Build and Test / build-and-test (windows-latest) (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
				
			Build and Test / publish-tag (push) Has been skipped
				
			Build and Test / build-and-test (macos-latest) (push) Has been cancelled
				
			Build and Test / build-and-test (windows-latest) (push) Has been cancelled
				
			* 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
					
				@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user