New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-plugin-catch-links] Links fail when domain name is included in link #3546
Comments
Does the pathname exist on the anchor? If it does that sounds fine. |
yeah, usually for these links, you'd pass in |
We should detect if the link is pointed to a different domain and then let the browser handle the link click normally. A PR for this would be great! |
Any updates? |
@alem0lars There's a PR already open for this issue - #7779 Once it is merged the fix will be available for Gatsby v1, this issue has already been fixed for Gatsby v2. If you want to give that a try, we have nicely written migration guide. |
Fixed in #7779 |
When you have an anchor tag in markdown, links are not prefixed (#3316); therefore opening the link in a new tab fails. To get around this, you can pass in the absolute url instead of just a relative url.
However, when you just click on the link regularly, it will append the entire absolute url to the existing url. The reason is because of this line: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-catch-links/src/catch-links.js#L61. The entire
href
attribute gets passed in when thehost
of thehref
matches thehost
of the page you are on.Would it be possible to change this line to
This would solve the issue but I'm not sure if it'll be problematic for others.
The text was updated successfully, but these errors were encountered: