Skip to Content
OpportunitiesTechnicalIssue ReferenceCanonicalsCanonical tag uses a relative URL

Canonical tag uses a relative URL

What it is

The page’s canonical tag gives a relative address, such as /blog/pricing-guide, pricing-guide or //example.com/blog/pricing-guide, instead of a full URL starting with https://. Anyone reading the tag has to build the full address from the URL of the page it appears on.

Why it matters

Google recommends absolute URLs  in canonical tags: relative paths are supported but can cause problems later. A path resolves against whatever host serves it, so a staging copy or an http version of the site declares itself canonical. A path without a leading slash resolves against the current folder. And a URL written without its scheme, such as example.com/pricing, is read as a path , which Google says may lead it to ignore the tag.

How Asky checks it

Asky reads the href of the first <link rel="canonical"> with an address in the page’s raw HTML, trims spaces at both ends, and reports it when it does not start with http:// or https://, in any letter case. That covers root-relative paths (/pricing), paths without a slash, protocol-relative URLs (//example.com/pricing) and an address missing its scheme. A tag with an empty href is reported as canonical missing instead. Asky does not check that the resolved URL loads. The same tag can also raise canonicalised, when it resolves to another page, and the fragment issue, when it contains #.

Reported as a warning with medium severity.

How to fix it

  1. Rewrite the canonical as a full URL: https://, your preferred host (with or without www, as your site uses it) and the path.
  2. Fix it where it is generated. Build the URL in the template from your site’s configured production address, not from the host of the incoming request, so staging and preview copies point at the live site.
  3. SEO plugins and CMS canonical settings usually output full URLs already, so a relative value tends to come from a custom code field, a theme or a hand-typed override. In Webflow, set the global canonical URL in the site’s SEO settings.
  4. Check that the full URL names the page itself (or the true original, for a copy) and has no # part.
  5. Keep one canonical tag per page, in the <head>.

Example

https://example.com/blog/pricing-guide names itself with a path only:

<!-- Before --> <link rel="canonical" href="/blog/pricing-guide"> <!-- After --> <link rel="canonical" href="https://example.com/blog/pricing-guide">

← Back to Canonicals

Last updated on