Parsing frontmatter
```diff
- import { serialize } from 'next-mdx-remote/serialize'
- import { MDXRemote } from 'next-mdx-remote'
+ import { serialize } from 'next-mdx-remote-client/serialize'
+ import { MDXClient } from 'next-mdx-remote-client'
import { Test } from '../mdxComponents'
+ import { ErrorComponent } from '../components'
const components = { Test }
export default function TestPage({ mdxSource }) {
+ if ("error" in mdxSource) {
+ return ;
+ }
return (
{mdxSource.frontmatter.title}
-
+
)
}
export async function getStaticProps() {
// MDX text - can be from a local file, database, anywhere
const source = `---
title: Test
---
Some **mdx** text, with a component `
- const mdxSource = await serialize(source, { parseFrontmatter: true })
+ const mdxSource = await serialize({source, options: { parseFrontmatter: true }})
return { props: { mdxSource } }
}
```