DEV Community

Vivacoda
Vivacoda

Posted on

Gatsby wordpress

Hello there
I am trying to add a path prefix for blog-post.js
Explanation:
everything works fine i add
Static pages index, blog ....
i change the path on the gatsby-node.js
i see the preview of my wordpress on my blog page but when i click i got a 404

gatsby-node.js

const { postsPerPage } = graphqlResult.data.wp.readingSettings
const postsChunkedIntoArchivePages = chunk(posts, postsPerPage)
const totalPages = postsChunkedIntoArchivePages.length
return Promise.all(
postsChunkedIntoArchivePages.map(async (\_posts, index) => {
const pageNumber = index + 1
const getPagePath = page => {
if (page > 0 && page <= totalPages) {
// Since our homepage is our blog page
// we want the first page to be "/" and any additional pages
// to be numbered.
// "/blog/2" for example
return page === 1 ? `/blog/` : `/blog/${page}`
}
return null
}
Enter fullscreen mode Exit fullscreen mode

when i click on a post i got 404 and i see my post at root
Search:

/hello-world/
/404.html
/404/
Enter fullscreen mode Exit fullscreen mode

Any idea Thanks

Top comments (0)