create-react-blog
create-react-blog copied to clipboard
Statically define MDXComponent
In routes/posts/2019-01-06-welcome/post.js, it sets function to import document.mdx.
getContent: () => import('./document.mdx')
In routes/index.js, it reads the data from
getView: async () => {
let { default: MDXComponent, ...other } = await getContent()
return { MDXComponent, ...other }
}
Does MDXComponent contain all the markdown data?
If I want to set the MDXComponent statically, could I do
return Navi.route({
title,
getData: (req, context) => ({
date,
pathname,
slug,
previousDetails: previousPost && {
title: previousPost.title,
href: join(context.blogRoot, 'posts', previousSlug),
},
nextDetails: nextPost && {
title: nextPost.title,
href: join(context.blogRoot, 'posts', nextSlug),
},
...meta,
}),
MDXComponent, // assume MDXComponent contains all the markdown data
})