question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gatsby rewrites hrefs?

See original GitHub issue

Hi there, we are unable to write a simple link using <a href=""> and passing query params, I do wonder if Gatsby rewrites for some reason the links strimming out the params.

We can’t use <Link> from Gatsby since these are external links.

I looked in previous issues and I can’t find much. Is this an expected behaviour?

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aterrenocommented, Mar 6, 2019

@DSchau spot on, thanks a lot, it’s now fixed and working.

1reaction
DSchaucommented, Mar 6, 2019

To be clear, which link is manifesting the issue? Or are all of them?

Generally - GatsbyLink should not be used for external links. It’s for internal links to other pages within your application. If you open your console, you’ll see warnings like “A page not found for <route>” because you’ve used an external link.

As far as the search params, I think that’s an issue with hydration. The search param isn’t known at build time, so you will likely want to tap into componentDidMount to grab the search params and update them statefully.

Does that make sense?

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby-remark-rewrite-relative-links
gatsby -remark-rewrite-relative-links. Gatsby is powered by the amazing Gatsby community and Gatsby, the company. Subscribe to our newsletter. Subscribe.
Read more >
[gatsby-link] Programmatically change a.href #21610 - GitHub
Is there a way to change a.href of an anchor created with Gatbsy's Link component, so that clicking the link leads to the...
Read more >
Gatsby: Navigation links to top level route on subpages ...
The Link component has been rewritten by a custom Link component and the route matching of the custom Link component was not done...
Read more >
gatsby-remark-rewrite-relative-links examples - CodeSandbox
Learn how to use gatsby-remark-rewrite-relative-links by viewing and forking example apps that make use of gatsby-remark-rewrite-relative-links on CodeSandbox.
Read more >
gatsby-plugin-catch-links | Yarn - Package Manager
Changelog: gatsby-plugin-catch-links. All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found