-
-
Save brunosabot/4653bf5059006b804ef3da778c04de51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GetStaticProps } from "next"; | |
import loadGreyMatterPost from "../lib/loadGreyMatterPost"; | |
import transformGreyMatterToMDX from "../lib/transformGreyMatterToMDX"; | |
export const getStaticProps: GetStaticProps = async ({ params }) => { | |
try { | |
const [post] = loadGreyMatterPost(params); | |
const mdxSource = transformGreyMatterToMDX(postt); | |
return { | |
props: { | |
source: mdxSource, | |
post: { | |
creator: post.data.creator, | |
date: post.data.date.toString(), | |
lang: post.data.lang, | |
path: post.data.path, | |
title: post.data.title, | |
}, | |
}, | |
}; | |
} catch (e) { | |
return { notFound: true }; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment