jamstack-cms/jamstack-ecommerce

Navbar links rise a problem

boulaffasae opened this issue · 2 comments

When user is not on Homepage /, a problem occur in the navbar links. All links link to a misplaced file.

  1. Navigate to the New arrivals page
  2. Now click on another navbar link, such as Sofas
  3. A 404 page is showen, /new-arrivals/sofas Not Found

Why the problem occur ?

In the following JavaScript code,

<Link to={l.link} key={i}>

link values are missing a / prefix. And it render as:

<a href="sofas>

How can we resolve the issue ?

Prefix all links with a /.

<Link to={`/${l.link}`} key={i}>

@boulaffasae I got the same problem as well. I tried but your resolve doesn't work. I found the links work fine when you don't upgrade the package.json and yarn.lock files!

Then this might be because of this PR feat(gatsby): Add support for relative links #24054