Lorenzo Fiamingo
Lorenzo Fiamingo

Reputation: 4069

NuxtLink redirecting to wrong url

I have a static generated Nuxt site. When I host it loaclly everything works fine but when I load it in GitHub Pages, NuxtLinks hrefs are not correct.

For example one of my link is:

<NuxtLink to="/iot">IoT</NuxtLink>

On localhost my site index is located in http://localhost:3000 and I correctly land on http://localhost:3000/iot.

On (since it's in a Repo) my site index is located in https://lorenzofiamingo.com/prisma/ and I land on in https://lorenzofiamingo.com/iot instead of in https://lorenzofiamingo.com/prisma/iot.

How can I amend this behavior (correcting the root)?

Upvotes: 0

Views: 557

Answers (1)

tony19
tony19

Reputation: 138206

Configure router.base to set the base URL:

// nuxt.config.js
export default {
  router: {
    base: '/prisma/'
  }
}

Upvotes: 2

Related Questions