forked from gatsbyjs/gatsby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use source-specific default layouts (gatsbyjs#36)
* set up test content * backwards compatibility for defaultLayout * use source default layout and fallback to default
- Loading branch information
1 parent
4074b27
commit 671a931
Showing
3 changed files
with
41 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
module.exports = pluginOptions => | ||
Object.assign( | ||
module.exports = pluginOptions => { | ||
const options = Object.assign( | ||
{ | ||
extensions: [".mdx"], | ||
mdPlugins: [], | ||
hastPlugins: [] | ||
hastPlugins: [], | ||
defaultLayouts: {} | ||
}, | ||
pluginOptions | ||
); | ||
|
||
// backwards compatibility for `defaultLayout` | ||
if (options.defaultLayout && !options.defaultLayouts.default) { | ||
options.defaultLayouts.default = options.defaultLayout; | ||
} | ||
|
||
return options; | ||
}; |