Skip to content

Commit 6874cca

Browse files
author
LB
authored
feat: Change mdx flag into mdxOtherwise to prevent confusion (#21404)
* Change flag name to prevent confusion * Still check mdx flag so we don't break existing theme usage
1 parent 40ac9be commit 6874cca

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

packages/gatsby-theme-blog-core/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ module.exports = {
5454

5555
### Theme options
5656

57-
| Key | Default value | Description |
58-
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
59-
| `basePath` | `/` | Root url for all blog posts |
60-
| `contentPath` | `content/posts` | Location of blog posts |
61-
| `assetPath` | `content/assets` | Location of assets |
62-
| `mdx` | `true` | Configure `gatsby-plugin-mdx`. Note that most sites will not need to use this flag. If your site has already configured `gatsby-plugin-mdx` separately, set this flag `false`. |
57+
| Key | Default value | Description |
58+
| ------------------------ | ---------------- | -------------------------------------------------------------------------------- |
59+
| `basePath` | `/` | Root url for all blog posts |
60+
| `contentPath` | `content/posts` | Location of blog posts |
61+
| `assetPath` | `content/assets` | Location of assets |
62+
| `mdxOtherwiseConfigured` | `false` | Set this flag `true` if `gatsby-plugin-mdx` is already configured for your site. |
6363

6464
#### Example usage
6565

packages/gatsby-theme-blog-core/gatsby-config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ const withDefaults = require(`./utils/default-options`)
22

33
module.exports = themeOptions => {
44
const options = withDefaults(themeOptions)
5-
const { mdx = true } = themeOptions
5+
let { mdxOtherwiseConfigured = false, mdx: legacyConfigureMdxFlag = true } = themeOptions // keep mdx flag so we don't introduce a breaking change
6+
67
return {
78
siteMetadata: {
89
title: `Blog Title Placeholder`,
@@ -20,7 +21,7 @@ module.exports = themeOptions => {
2021
],
2122
},
2223
plugins: [
23-
mdx && {
24+
(!mdxOtherwiseConfigured && legacyConfigureMdxFlag) && {
2425
resolve: `gatsby-plugin-mdx`,
2526
options: {
2627
extensions: [`.mdx`, `.md`],

packages/gatsby-theme-blog/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ module.exports = {
5656

5757
### Theme options
5858

59-
| Key | Default value | Description |
60-
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
61-
| `basePath` | `/` | Root url for all blog posts |
62-
| `contentPath` | `content/posts` | Location of blog posts |
63-
| `assetPath` | `content/assets` | Location of assets |
64-
| `mdx` | `true` | Configure `gatsby-plugin-mdx`. Note that most sites will not need to use this flag. If your site has already configured `gatsby-plugin-mdx` separately, set this flag `false`. |
59+
| Key | Default value | Description |
60+
| ------------------------ | ---------------- | -------------------------------------------------------------------------------- |
61+
| `basePath` | `/` | Root url for all blog posts |
62+
| `contentPath` | `content/posts` | Location of blog posts |
63+
| `assetPath` | `content/assets` | Location of assets |
64+
| `mdxOtherwiseConfigured` | `false` | Set this flag `true` if `gatsby-plugin-mdx` is already configured for your site. |
6565

6666
#### Example configuration
6767

packages/gatsby-theme-notes/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,17 @@ module.exports = {
4545
```
4646

4747
3. Add notes to your site by creating `md` or `mdx` files inside `/content/notes`.
48+
4849
> Note that if you've changed the default `contentPath` in the configuration, you'll want to add your markdown files in the directory specified by that path.
4950
51+
4. Run your site using `gatsby develop` and navigate to your notes. If you used the above configuration, your URL will be `http://localhost:8000/notes`
52+
5053
### Options
5154

52-
| Key | Default value | Description |
53-
| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
54-
| `basePath` | `/` | Root url for all notes pages |
55-
| `contentPath` | `/content/notes` | Location of notes content |
56-
| `mdx` | `true` | Configure `gatsby-plugin-mdx`. Note that most sites will not need to use this flag. If your site has already configured `gatsby-plugin-mdx` separately, set this flag `false`. |
57-
| `homeText` | `~` | Root text for notes breadcrumb trail |
58-
| `breadcrumbSeparator` | `/` | Separator for the breadcrumb trail |
55+
| Key | Default value | Description |
56+
| ------------------------ | ---------------- | -------------------------------------------------------------------------------- |
57+
| `basePath` | `/` | Root url for all notes pages |
58+
| `contentPath` | `/content/notes` | Location of notes content |
59+
| `mdxOtherwiseConfigured` | `false` | Set this flag `true` if `gatsby-plugin-mdx` is already configured for your site. |
60+
| `homeText` | `~` | Root text for notes breadcrumb trail |
61+
| `breadcrumbSeparator` | `/` | Separator for the breadcrumb trail |

packages/gatsby-theme-notes/gatsby-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = options => {
2-
const { mdx = true, mdxLayouts = {} } = options
2+
const { mdxOtherwiseConfigured = false, mdx: legacyConfigureMdxFlag = true, mdxLayouts = {} } = options
33

44
return {
55
siteMetadata: {
@@ -8,7 +8,7 @@ module.exports = options => {
88
siteUrl: `http://example.com/`,
99
},
1010
plugins: [
11-
mdx && {
11+
(!mdxOtherwiseConfigured && legacyConfigureMdxFlag) && {
1212
resolve: `gatsby-plugin-mdx`,
1313
options: {
1414
extensions: [`.md`, `.mdx`],

0 commit comments

Comments
 (0)