DEV Community

Discussion on: How to Create Pages Dynamically in Gatsby Using MDX

Collapse
 
umbralimi profile image
Fraser Gorrie

That was a very good explanation! Thank you!

I guess it's just me. I wrote a file to the /src/posts/ calledtest-me.md and my gatsby-config.js settings lead to the generation of the url /test-me so I assumed (naively, it seems) that gatsby-plugin-mdx did that by itself.

I had frontmatter in test-me.md that included the url I wanted to use, in this case path: "open-for-business". Then I wrote the createPages() function much as you have and when I checked, and clean-ed, both /test-me and /open-for-business had been created.

Anyway, that's just a bit of background on what I did and was trying to do. Your explanation will doubtless lead me to the point where I just have /open-for-business.

Again. Great explanation and thanks for responding so quickly!

Thread Thread
 
malroun1 profile image
Malik Gabroun

no worries.

perhaps, if you post your usage of mdx and sourcefile plugin in gatsby-config and createPage method in gatsby-node

also you can see my implementation in a starter repo here

Thread Thread
 
umbralimi profile image
Fraser Gorrie

I found the problem. I installed your starter from the article, confirmed that you only have 1 page created per mdx file and traced my issue to the inclusion of gatsby-plugin-page-creator that pointed at the same folder where I had the mdx files. Simple. I didn't understand the concept properly of the gatsby and mdx build process. You helped with that. Thanks

Thread Thread
 
malroun1 profile image
Malik Gabroun

great, glad I could help