Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial #19 - Generating Pages. Not creating pages. #4

Open
Piterwk1 opened this issue Mar 28, 2021 · 1 comment
Open

Tutorial #19 - Generating Pages. Not creating pages. #4

Piterwk1 opened this issue Mar 28, 2021 · 1 comment

Comments

@Piterwk1
Copy link

When i click on any project result is :
Gatsby.js development 404 page
There's not a page yet at /projects/the-drum-stop.
I did gatsby clean, VSC reload and new develop. Still 404.

@rafixog
Copy link

rafixog commented Apr 2, 2021

Hello @Piterwk1! Try paste this code into gatsby-node.js
const path = require(path)

exports.createPages = async ({ graphql, actions }) => {
const { data } = await graphql(query { allMarkdownRemark { nodes { frontmatter { slug } } } })

data.allMarkdownRemark.nodes.forEach(node => {
actions.createPage({
path: "/projects/" + node.frontmatter.slug,
component: path.resolve("./src/templates/project-details.jsx"),
context: { slug: node.frontmatter.slug },
})
})
}

EDIT: remember about syntax in graphql invoke 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants