diff --git a/gatsby-node.js b/gatsby-node.js index 5ca532f28..72d4f2206 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -193,8 +193,7 @@ exports.createPages = ({ graphql, actions }) => { path: `/snippet${snippet.node.slug}`, component: snippetPage, context: { - slug: snippet.node.slug, - scope: `./snippets` + snippet: snippet.node } }); } else { @@ -202,8 +201,7 @@ exports.createPages = ({ graphql, actions }) => { path: `/archive${snippet.node.slug}`, component: snippetPage, context: { - slug: snippet.node.slug, - scope: `./snippets_archive` + snippet: snippet.node } }); } diff --git a/src/docs/templates/SnippetPage.js b/src/docs/templates/SnippetPage.js index 9ab06301c..7db74c381 100644 --- a/src/docs/templates/SnippetPage.js +++ b/src/docs/templates/SnippetPage.js @@ -11,7 +11,7 @@ import BackArrowIcon from '../components/SVGs/BackArrowIcon'; // Individual snippet page template // =================================================== const SnippetPage = props => { - const snippet = props.data.snippet; + const snippet = props.pageContext.snippet; return ( <> @@ -50,35 +50,3 @@ export default connect( }), null, )(SnippetPage); - -export const pageQuery = graphql` - query SnippetBySlug($slug: String!) { - logo: file(absolutePath: { regex: "/logo_reverse_md.png/" }) { - id - childImageSharp { - fixed(height: 45, width: 45) { - src - } - } - } - snippet (slug: {eq: $slug }) { - title - html { - full - code - example - text - } - code { - src - } - tags { - all - } - title - text { - short - } - } - } -`;