Simple gatsby-plugin-canonical-urls Protocol Bug
See original GitHub issueDescription
The gatsby-plugin-canonical-urls plugin adds a rel=canonical <link> tag to the head of each HTML page.
Here is an example of code added to the head of the html document:
<link rel="canonical" href="https://www.abc.com" data-baseprotocol="https:" data-basehost="www.abc.com">
The potential problem is with the protocol. It states the protocol is “https:”. But shouldn’t it be “https” without the colon?
How to Reproduce
- Start with the Gatsby Starter Default.
- Install the gatsby-plugin-canonical-urls plugin.
- Run “gatsby develop”
- Open “localhost:8000” in Google Chrome.
- Open the developer tools (click F12).
- Select “Elements”
- Expand the “head” section.
- Look for the rel=canonical <link> tag.
- Find the property data-baseprotocol. It should be equal to “https” not “https:”
Solution
Open the gatsby-srr.js file. And modify line 29 to remove the colon. Here is what line 29 should look like:
data-baseprotocol={parsed.protocol.slice(0, -1)}
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
gatsby-plugin-canonical-urls
Add canonical links to HTML pages Gatsby generates. This implementation is primarily helpful for distinguishing between https/http, www/no-www but could ...
Read more >Ask Question - Stack Overflow
Great Answer Ferran. +1 But "gatsby-plugin-canonical-urls" does it nicely. It's a headache to do it manually. Isn't it?
Read more >url scheme must be http or https for cors request. swagger - You.com ...
I wrote a swagger documentation for a set of APIs that I have built. But in the swagger's server response, it throws an...
Read more >How to Build a Developer Blog with Gatsby and MDX - SitePoint
Want to build your own developer blog? Learn how to make your content shine with this extensive guide on setting up a Gatsby...
Read more >Roadmap - golangci-lint
Bugs. Please file an issue for bugs, missing documentation, or unexpected behavior. See Bugs ... bump gatsby-plugin-canonical-urls in /docs (#1390) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi!
Sorry to hear you’re running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you’re able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.
If you’re up for it, we’d very much appreciate if you could provide a minimal reproduction and we’ll be able to take another look.
Thanks for using Gatsby! 💜
Hey again!
It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m
HUMAN_EMOTION_SORRY
. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!Thanks again for being part of the Gatsby community! 💪💜