Unable to generate development bundle with markdown files #30981
-
DescriptionCreated a brand new project using gatsby new. Added transformer-remark plugin to parse md files.
The mine.md file only has the following frontmatter and no other content. As a result of the error I am unable to load markdown files which is crucial for my project. --- Steps to reproduce
---
Expected resultThe development bundle should get generated without errors. Actual resultWebpack complains, with the following
EnvironmentSystem: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi! Gatsby has the conventation that you can only place valid React components (that serve as pages) inside So you have two options: Option b) would be something like:
|
Beta Was this translation helpful? Give feedback.
Hi!
Gatsby has the conventation that you can only place valid React components (that serve as pages) inside
src/pages
. An exception to this is gatsby-plugin-mdx which will allow you to place MDX files (and MD files if you edit theextensions
option) insidesrc/pages
.So you have two options:
a) use
gatsby-plugin-mdx
b) Use the File System Route API (https://www.gatsbyjs.com/docs/reference/routing/file-system-route-api/) to take your MD files and create pages this way.
Option b) would be something like:
src/pages/{MarkdownRemark.title}.js
and then you'd get the content from your markdown files for that template.