Routes to other pages not working in production only
See original GitHub issueNone of my links from my index route (“/”) are working in production. They all reload the index page but the URL changes to reflect that the page has been navigated to.
I.e. if I click a button to take me to my blog page, the url will change to “www.mysite.com/blog” but the home page just reloads.
I have tried using <Button> with href, and Link via gatsby-link. Neither of which seem to make a difference.
The weird part is that external links placed in the navbar within the index.js
file in the Layouts folder work fine.
I haven’t made any changes to the site for over a month, when it was working completely fine. Everything works as intended in development. And there are no errors in dev OR production.
Any idea as to how I might solve this? I need to fix this ASAP. Any help is appreciated! Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:33 (15 by maintainers)
Top GitHub Comments
FIxed. Removed
pathPrefix
from mygatsby-config.js
file and everything is working again. Thanks @KyleAMathews! I think the #2551 nails it.Alternatively, I could build with the --prefix-paths flag if I wanted to keep that variable.
Is there a way to resolve #2551?
Played around with @Swizec’s site and found that building locally with a
pathPrefix
in thegatsby-config.js
is what was breaking things. Commented that out and things worked as expected.Not sure when or where this started happening. Found it by adding console.log to find-page.js and seeing that pathPrefix was being passed in.