gatsby-paginate icon indicating copy to clipboard operation
gatsby-paginate copied to clipboard

Wrong paginated index paths after refreshing a page

Open 5t111111 opened this issue 6 years ago • 0 comments

I created my site with pagination using the template in the readme, but I have found that the links to paginated index pages become wrong after refreshing a page, for example:

  • When you are in http://example.com/2/ and refresh the page, links to previous/next pages become something like http://example.com/2/1/, http://example.com/2/3/

This problem seems to occur only when I build a static site, and not via gatsby develop.

As a workaround, I've changed urls passed to NavLink to the following ones to make them always link to the paths relative to the root path.

      <div className="previousLink">
        <NavLink test={first} url={`/${previousUrl}`} text="Go to Previous Page" />
      </div>
      <div className="nextLink">
        <NavLink test={last} url={`/${nextUrl}`} text="Go to Next Page" />
      </div>

I am not sure this is a problem related to Gatsby itself rather than gatsby-paginate though.

5t111111 avatar Apr 09 '18 04:04 5t111111