Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Simple gatsby-plugin-canonical-urls Protocol Bug #27298
Comments
|
Please assign me this issue |
|
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! |
|
@LekoArts Sir, Can I work on this issue and solve it? |
|
@rutujak24 This issue lacks a clear issue/error description so there isn't anything actionable here. Please have a look at the issues tagged with hacktoberfest. |
|
@rutujak24 I have updated my original message to include information on how to reproduce the error. I didn't create a reproduction since the error is found by simply using a starter project and installing the plugin. There is no special code needed to reproduce the error. I do also include the steps to fix the error. It's a very simple error. |
|
Can you cite a reference stating the protocol should be without a colon? I can't find a reference and everything I find on the canonical tag also has a colon. |
|
Honestly I'm of half a mind to just drop |
|
Before posting the issue, I spend a fair amount of time looking for any specification for So I don't have a reference that says the protocol should not have the colon. But I've never seen a reference to the protocol that includes the colon. Plus, I could see how this could have been an oversight by the original programmer. The field |
|
Yes I do agree with @mikleing |
|
Considering it's been like this for two years, I would suggest to either keep it as is or drop it entirely. If nothing is actually using this, they're just dead bytes. And arguably, the protocol of the canonical url should be leading anyways so it feels like a redundant field regardless. |
|
Ok, @pieh pointed me towards https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-canonical-urls/src/gatsby-browser.js#L6-L21 and that this is probably the reason for these attributes existing in the first place. Nothing else. So removing the colon would break that so we're not going to do that. So I'd propose to drop these attributes and get this information straight from the canonical url in browser.js instead. |
|
@pvdz That sounds like a good plan. |
My PR is pretty much exactly this. :-) |
|
Hiya! This issue has gone quiet. Spooky quiet. We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! |


Description
The gatsby-plugin-canonical-urls plugin adds a rel=canonical 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
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)}