Closed ArthurHwang closed 5 years ago
Have the same problem and I think problem at this line https://github.com/pixelstew/gatsby-paginate/blob/master/src/index.js#L15
My temporary solution:
function buildPath(index, pathPrefix) {
return index > 1 ? `${pathPrefix}/${index}` : `${pathPrefix}`
}
module.exports = async ({ graphql, actions: { createPage } }) => {
/* ... */
createPaginatedPages({
buildPath,
createPage,
edges: posts,
pageTemplate: blogTemplate,
pathPrefix: '/blog',
pageLength: 10,
})
}
My gatsby-node.js:
Template:
Everything works fine UNLESS refreshing from the first page of pages created by
gatsby-paginate
What happens is when a user refreshes from the first page of created paginated pages, this plugin for example goes to URL:
/blog
instead ofhttps://www.website.com/blog
. If a user refreshes from the 2nd page, it works fine.Any help would be greatly appreciated.