Skip to content

Statically define MDXComponent #27

@Danissss

Description

@Danissss

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

      })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions