Closed kilinkis closed 4 years ago
When gatsby 404s, it should give you a list of generated pages. What are these and if you go to them do they work?
thanks for replying @justinwhall :)
so, I see this:
success building schema - 0.279 s
posts => [ 1 ]
createBlogPage 0
create post: hello-world/
beers => [ 14 ]
createBeersPage 0
create beer post: beer/fullers/
success createPages - 1.806 s
but then, if I visit http://localhost:8000/hello-world/ it's just all blank and in the terminal I see: Page not found /hello-world
if I visit a real 404, let's say http://localhost:8000/page-that-doesnt-exists I see the 404 page with this list of pages:
Pages (7)
/
/hello-world//
/beers/
/beer/beer/fullers//
/404/
/page/
/404.html
I had the same problem and found the cause. This bug only appears in dev mode and is caused by a trailing slash within createPosts.js at line 77. post.uri already has a trailing slash, so it ends up double breaking the page creation.
createPage({
path: `/blog/${post.uri}/`, // <== remove this trailing slash
component: postTemplate,
context: post,
})
Ahh, ya good catch. Weird that didn't happen for me. Have to give it a go again. Did this fix your issue @kilinkis ?
amazing! yes, that fixed it :)
thank you @peteluffman !
I enabled the permalinks (chose Post Name 'http://localhost:3030/sample-post/') then the post url is http://localhost:3030/hello-world/ and on the gatsby site, the generated link points to /blog/hello-world
even if I manually go to http://localhost:8000/hello-world/ still returns a blank page, and in the terminal I see "Page not found /hello-world".
Then updated the gastsby config to point to http://localhost:8000/hello-world/ and started the dev server again, and now the link has the correct URL but the blank page / 404 persists.
Same happens for the Beer post type.
any ideas? thanks