DEV Community

Vivacoda
Vivacoda

Posted on

2 2

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

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more