Skip to content

Commit

Permalink
fix: remove extraLayouts
Browse files Browse the repository at this point in the history
This is not longer supported as you can define your own layouts as components,
following this guide: https://www.gatsbyjs.com/docs/how-to/routing/layout-components/
  • Loading branch information
eng618 committed May 11, 2023
1 parent 6b31908 commit 6c4c0dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
27 changes: 6 additions & 21 deletions packages/example/src/pages/guides/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -380,27 +380,12 @@ array in the theme options.

## Adding new MDX layouts

`gatsby-plugin-mdx` and `gatsby-source-filesystem` can work together to
automatically template MDX files in a given directory. See the
[plugin documentation](https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/#default-layouts).
This would need to be added as custom components following this
[Layout component docs](https://www.gatsbyjs.com/docs/how-to/routing/layout-components)
outlined by Gatsby.

The Carbon theme already comes with a default layout, but you can add your own
with the `extraLayouts` option.

```js
plugins: [
{
resolve: 'gatsby-theme-carbon',
options: {
extraLayouts: {
posts: require.resolve('./src/layouts/postLayout.js')
}
},
],
```
Note that the extra layouts do not inherit from theme default. Custom layouts
start from a clean slate. If you want to iterate on the Carbon template, copy
`/gatsby-theme-carbon/src/templates/Default.js` to your custom template as a
Note that the layouts do not inherit from theme default. Custom layouts start
from a clean slate. If you want to iterate on the Carbon template, copy
`/gatsby-theme-carbon/src/components/Layout.js` to your custom template as a
starting point. When doing this, you may also need to change the import paths to
the correct location.
2 changes: 0 additions & 2 deletions packages/gatsby-theme-carbon/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module.exports = (themeOptions) => {
gatsbyPluginSharpOptions = {},
isServiceWorkerEnabled = false,
isSwitcherEnabled = true,
extraLayouts = {},
} = themeOptions;

const theme = { ...defaultTheme, ...themeOption };
Expand Down Expand Up @@ -119,7 +118,6 @@ module.exports = (themeOptions) => {
defaultLayouts: {
default: require.resolve('./src/templates/Default.js'),
home: require.resolve('./src/templates/Homepage.js'),
...extraLayouts,
},
},
},
Expand Down

0 comments on commit 6c4c0dd

Please sign in to comment.