#Is it possible to prevent the base url being appended to the href for a next/link?

7 messages · Page 1 of 1 (latest)

woeful wing
#

We currently have multiple next apps hosted as different projects but living under the same url through the use of cloudfront as micro-frontends. Each individual app has a different base url set to support this architecture.
However, we are coming across an issue where when we use next/link, the href gets turned into https://www.website.com/(appbaseurl)/page from a normal expected href of https://www.website.com/page.
We just want the next link to not append the base url to the href. Is this possible at all?

Thanks

strong spadeBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
wheat leaf
humble rain
#

Taking over from @woeful wing as they're off this issue now, it's a bit of a pain to explain unfortunately.

We have Website#1 and Website#2, and a SharedNavigation component as an NPM package, we pass the '@next/link' component from each website down into the SharedNavigation component.

Website#1 has a base path of '/'
Website#2 has a base path of '/blogapp'

Website#2 has sub routes for '/featured', etc

Currently with Next link the url generated is https://www.website.com/blogapp/featured

But we'd like it to be https://www.website.com/featured

As for our <Link/> component, we're effectively writing a wrapper around the '@next/link' component in our SharedNavigation package.

woeful wing
#

Anyone have any idea how this could be solved?

fathom barn
#

You do not use <Link> to link between "multiple next apps hosted as different projects"