From 3be0645a205aa5fb494d505421c78c8caf5dfc32 Mon Sep 17 00:00:00 2001 From: Daniele Guido Date: Tue, 12 Mar 2024 17:18:33 +0100 Subject: [PATCH] add back link to tutorial page --- gatsby-node.js | 12 ++++++++++++ src/components/PageLayout.js | 10 ++++++++-- src/components/TutorialCard.js | 13 +++++-------- src/templates/Tutorial.js | 30 ++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 src/templates/Tutorial.js diff --git a/gatsby-node.js b/gatsby-node.js index c888201..3c9339f 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -276,6 +276,18 @@ exports.createPages = async function ({ actions, graphql }) { 2 ) ) + actions.createPage({ + path: `/tutorial/${node.name}`, + component: require.resolve(`./src/templates/Tutorial.js`), + context: { + type: "tutorial", + data: { + ...tutorialsMap[node.name], + body: node.childMdx.body, + video: node.childMdx.frontmatter.video, + }, + }, + }) }) // // Write to JSON files diff --git a/src/components/PageLayout.js b/src/components/PageLayout.js index d508548..2ae4a79 100644 --- a/src/components/PageLayout.js +++ b/src/components/PageLayout.js @@ -23,7 +23,7 @@ const PageLayout = ({ children, path, pageContext }) => { }, []) useEffect(() => { // scroll to 0 0 - window.scrollTo(0, 0) + // window.scrollTo(0, 0) if (path === "/") { setShow(false) } else { @@ -32,7 +32,13 @@ const PageLayout = ({ children, path, pageContext }) => { }, [path]) return ( - + impresso-datalab