Reputation: 1593
createPage({
path: `product/${node.id}/[any-matching-string]`,
component: path.resolve(`./src/templates/productDetail.js`),
context: {
productId: node.id
},
})
path: product/${node.id}/[any-matching-string],
How do i achieve such path?
url: someurl/product/id/[any string]
Upvotes: 1
Views: 421
Reputation: 1593
Yes.According to those two comments, it is possible duplicate of those questions. But i slightly wanted different settings.
exports.onCreatePage = async ({ page, actions }) => {
const { createPage } = actions
if (page.path === "/") {
page.matchPath = "/*"
createPage(page)
}
}
This is what i exactly wanted.
And in my index.js page, i have to use reach router.
If anyone need more details, comment here. I will share the complete code.
Upvotes: 1