From 6638159da1160f657bc8a9e964ac5851b0653180 Mon Sep 17 00:00:00 2001 From: Prince Date: Mon, 6 Jun 2022 15:31:54 +0400 Subject: [PATCH] chore: add dynamic page for job-description --- gatsby-node.js | 11 ++++++++++- src/pages/job-description/[id].tsx | 13 +++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/pages/job-description/[id].tsx diff --git a/gatsby-node.js b/gatsby-node.js index 9af3d2d..8e75445 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,7 +1,16 @@ /* eslint-disable import/order */ const path = require('path') -exports.onCreatePage = () => {} +exports.onCreatePage = async ({ page, actions }) => { + const { createPage } = actions + + if (page.path.match(/^\/job-description/)) { + page.matchPath = '/job-description/*' + + // Update the page. + createPage(page) + } +} const StylelintPlugin = require('stylelint-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin') diff --git a/src/pages/job-description/[id].tsx b/src/pages/job-description/[id].tsx new file mode 100644 index 0000000..5e160e3 --- /dev/null +++ b/src/pages/job-description/[id].tsx @@ -0,0 +1,13 @@ +import * as React from 'react' +import type { PageProps } from 'gatsby' +import Layout from 'common/components/layout/layout' + +const JobDescription = (props: PageProps) => { + return ( + + <>{props.params.id} + + ) +} + +export default JobDescription