Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I use this with gatsby-plugin-mdx? #6

Open
FezVrasta opened this issue Nov 24, 2019 · 2 comments
Open

How do I use this with gatsby-plugin-mdx? #6

FezVrasta opened this issue Nov 24, 2019 · 2 comments

Comments

@FezVrasta
Copy link

The menus GraphQL operation doesn't appear once I enable this plugin in a website using gatsby-plugin-mdx.

Do I need to configure it somehow?

@Julien76
Copy link

In the plugin configuration, you need to setup:

sourceNodeType: 'Mdx', 

Looking through the code and logging the intermediate results of the plugins, the mdx navigation is correct but it fails somehow to add menus in GraphQL.

It sometimes appear after a refresh and after updating one key in a frontmatter, but I have not been able to reproduce this behavior every time.

in GraphQL, the navigation appears correctly in SitePageContext however.

I need to understand more how the nodes are created but in the createNode function of this plugin, the menu is correct (using some console.log and checking the results) and it is registered in GraphQL (using the function getAllNodes from Gatsby) via the plugin but somehow it is not displayed in the GraphQL after the plugin has been executed.

@stackbithq do you have any idea why?

@wyqydsyq
Copy link

I've found that the menus node becomes available in GraphQL only after saving an .mdx document with the local development server already running. Upon initial npm run start it is missing, then saving any .mdx file results in the node appearing. Seems like maybe the plugin is missing some logic to execute when initially starting the dev server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants