Created
October 3, 2021 16:42
-
-
Save albertBarsegyan/0e7681c44b7ab1483b007a14949bd6a2 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 { MDXRemote } from 'next-mdx-remote'; | |
import getDocBySlug from '../src/services/getDocBySlug.mjs'; | |
import Image from 'next/image'; | |
import { serialize } from 'next-mdx-remote/serialize'; | |
export default function Blog({ content, meta }) { | |
const components = { | |
Image, | |
}; | |
return ( | |
<div> | |
<MDXRemote components={components} {...content} /> | |
</div> | |
); | |
} | |
export async function getStaticProps({ locale }) { | |
const { content, meta } = getDocBySlug('blog', locale); | |
const mdxSource = await serialize(content); | |
return { | |
props: { | |
content: mdxSource, | |
meta, | |
}, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment