upstream #1
| @@ -1,6 +1,6 @@ | ||||
| --- | ||||
| title: 'New features in v1' | ||||
| date: '2021-07-28' | ||||
| date: 2021-07-28T15:32:14Z | ||||
| tags: ['next-js', 'tailwind', 'guide'] | ||||
| draft: false | ||||
| summary: 'An overview of the new features released in v1 - code block copy, multiple authors, frontmatter layout and more' | ||||
|   | ||||
							
								
								
									
										11
									
								
								lib/mdx.js
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								lib/mdx.js
									
									
									
									
									
								
							| @@ -116,6 +116,7 @@ export async function getFileBySlug(type, slug) { | ||||
|       slug: slug || null, | ||||
|       fileName: fs.existsSync(mdxPath) ? `${slug}.mdx` : `${slug}.md`, | ||||
|       ...frontmatter, | ||||
|       date: frontmatter.date ? new Date(frontmatter.date).toISOString() : null, | ||||
|     }, | ||||
|   } | ||||
| } | ||||
| @@ -135,9 +136,13 @@ export async function getAllFilesFrontMatter(folder) { | ||||
|       return | ||||
|     } | ||||
|     const source = fs.readFileSync(file, 'utf8') | ||||
|     const { data } = matter(source) | ||||
|     if (data.draft !== true) { | ||||
|       allFrontMatter.push({ ...data, slug: formatSlug(fileName) }) | ||||
|     const { data: frontmatter } = matter(source) | ||||
|     if (frontmatter.draft !== true) { | ||||
|       allFrontMatter.push({ | ||||
|         ...frontmatter, | ||||
|         slug: formatSlug(fileName), | ||||
|         date: frontmatter.date ? new Date(frontmatter.date).toISOString() : null, | ||||
|       }) | ||||
|     } | ||||
|   }) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user