-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgatsby-node.js
More file actions
24 lines (21 loc) · 889 Bytes
/
gatsby-node.js
File metadata and controls
24 lines (21 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
const path = require("path");
exports.onCreatePage = ({ page, store, boundActionCreators }, { prefixes }) => {
const { createPage } = boundActionCreators;
if (page.path.match(/^\/project\/?$/)) {
// Intercept page/project.js component and make it match anything at /work/:project
// page.matchPath is a special key that's used for matching pages only on the client
page.matchPath = "/work/:project";
page.component = path.resolve("./src/pages/project.js");
createPage(page);
} else if (page.path.match(/^\/resource\/?$/)) {
// Intercept page/resource.js component and make it match anything at /resource/:resource
page.matchPath = "/resources/:resource";
page.component = path.resolve("./src/pages/resource.js");
createPage(page);
}
};