|
|
@ -22,13 +22,13 @@ async function getPost(slug: string[]): Promise<Post | null> { |
|
|
|
|
|
|
|
|
|
|
|
const postName = slug[1]; |
|
|
|
const postName = slug[1]; |
|
|
|
const postsDirectory = path.join(process.cwd(), 'content/essays'); |
|
|
|
const postsDirectory = path.join(process.cwd(), 'content/essays'); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
const fullPath = path.join(postsDirectory, `${postName}.mdx`); |
|
|
|
const fullPath = path.join(postsDirectory, `${postName}.mdx`); |
|
|
|
const fileContents = await fs.readFile(fullPath, 'utf8'); |
|
|
|
const fileContents = await fs.readFile(fullPath, 'utf8'); |
|
|
|
|
|
|
|
|
|
|
|
const { data, content } = matter(fileContents); |
|
|
|
const { data, content } = matter(fileContents); |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
title: data.title, |
|
|
|
title: data.title, |
|
|
|
createdAt: data.createdAt, |
|
|
|
createdAt: data.createdAt, |
|
|
@ -58,7 +58,7 @@ const Page = async ({ params }: { params: { dir: string[] } }) => { |
|
|
|
</time> |
|
|
|
</time> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<MDXRemote
|
|
|
|
<MDXRemote |
|
|
|
source={post.content} |
|
|
|
source={post.content} |
|
|
|
options={{ |
|
|
|
options={{ |
|
|
|
mdxOptions: { |
|
|
|
mdxOptions: { |
|
|
|