pixelstew / gatsby-paginate

A simple library for paginating posts in Gatsby js.
GNU General Public License v3.0
123 stars 26 forks source link

Wrong paginated index paths after refreshing a page #27

Open 5t111111 opened 6 years ago

5t111111 commented 6 years ago

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:

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.