Skip to content

Commit d08323c

Browse files
yamalightjohno
andcommitted
feat(docs): Clarify gatsby-plugin-mdx requirements for gatsby-source-filesystem (#15604)
* feat(docs): Clarify gatsby-plugin-mdx requirements for gatsby-source-filesystem Adds an example code and additional note explaining that mdx plugin needs to have filesystem pre-processing files. Ref: #15594 * Update packages/gatsby-plugin-mdx/README.md Co-Authored-By: John Otander <[email protected]> * Update packages/gatsby-plugin-mdx/README.md Co-Authored-By: John Otander <[email protected]>
1 parent fe625e2 commit d08323c

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

packages/gatsby-plugin-mdx/README.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,27 @@ After installing gatsby-plugin-mdx you can add it to your plugins list in your
6060

6161
```js
6262
module.exports = {
63-
plugins: [`gatsby-plugin-mdx`],
63+
plugins: [
64+
{
65+
resolve: `gatsby-source-filesystem`,
66+
options: {
67+
name: `pages`,
68+
path: `${__dirname}/src/pages/`,
69+
},
70+
},
71+
`gatsby-plugin-mdx`,
72+
],
6473
}
6574
```
6675

6776
By default, this configuration will allow you to create pages
6877
with `.mdx` files in `src/pages` and will process any Gatsby nodes
6978
with Markdown media types into MDX content.
7079

80+
Note that gatsby-plugin-mdx requires gatsby-source-filesystem to be present
81+
and configured to process local markdown files in order to
82+
generate the resulting Gatsby nodes.
83+
7184
### Configuration
7285

7386
gatsby-plugin-mdx exposes a configuration API that can be used similarly to
@@ -115,6 +128,20 @@ layout defined, even if it's imported manually using `import MDX from './thing.m
115128
// gatsby-config.js
116129
module.exports = {
117130
plugins: [
131+
{
132+
resolve: `gatsby-source-filesystem`,
133+
options: {
134+
name: `pages`,
135+
path: `${__dirname}/src/pages/`,
136+
},
137+
},
138+
{
139+
resolve: `gatsby-source-filesystem`,
140+
options: {
141+
name: `posts`,
142+
path: `${__dirname}/src/posts/`,
143+
},
144+
},
118145
{
119146
resolve: `gatsby-plugin-mdx`,
120147
options: {

0 commit comments

Comments
 (0)