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.

Simple gatsby-plugin-canonical-urls Protocol Bug

See original GitHub issue

Description

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

  1. Start with the Gatsby Starter Default.
  2. Install the gatsby-plugin-canonical-urls plugin.
  3. Run “gatsby develop”
  4. Open “localhost:8000” in Google Chrome.
  5. Open the developer tools (click F12).
  6. Select “Elements”
  7. Expand the “head” section.
  8. Look for the rel=canonical <link> tag.
  9. 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:closed
  • Created 3 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
LekoArtscommented, Oct 6, 2020

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! 💜

0reactions
github-actions[bot]commented, Jan 1, 2021

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! 💪💜

Read more comments on GitHub >

github_iconTop 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 >

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