squirrelscan
GitHub

og:url versus canonical: why they should be the same URL

When og:url and the canonical disagree, share counts split across two addresses. squirrel normalises both and compares them.

What og:url is for

og:url is the canonical address of the page as far as social platforms are concerned. It is what they use to deduplicate shares, so every share of the page accumulates against one identifier however the sharer arrived.

The <link rel="canonical"> tag does the same job for search engines. When the two disagree, usually over www, the scheme or a trailing slash, the page is presenting two canonical identities. Whether that has actually split a share count depends on which URLs people shared, but it is the condition under which counts fragment.

What squirrel checks

The rule runs on every crawled page and compares meta[property="og:url"] against link[rel="canonical"]. Both are resolved against the page URL and stripped of a trailing slash before comparison. It emits a single check named og-url-match:

  • Info when there is no og:url. Message: No og:url tag found.
  • Info when there is no canonical to compare against. Message: No canonical to compare og:url against.
  • Pass when the normalised values are equal. Message: og:url matches canonical URL.
  • Warn otherwise. Message: og:url does not match canonical URL, with og: https://example.com/page as the value and the raw canonical href as the expected value. Severity warning, weight 3.

Normalisation is whatever the URL parser does plus a trailing-slash strip. The parser resolves a relative value, lowercases the hostname, drops a default port and resolves dot segments; the extra step removes one trailing slash. A query string, a fragment and a case difference in the path all survive and are compared as-is.

How to fix it

<link rel="canonical" href="https://example.com/guides/url-structure" />
<meta property="og:url" content="https://example.com/guides/url-structure" />

Render both from the same value in the layout. That way a change to the canonical rule cannot leave og:url behind.

Rule IDsocial/og-url-match
CategorySocial Media
ScopePer-page
Severitywarning
Weight3/10

Enable / disable

Disable this rule

[rules]
disable = ["social/og-url-match"]

Disable all Social Media rules

[rules]
disable = ["social/*"]

Enable only this rule

[rules]
enable = ["social/og-url-match"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.

Social Media findings ship in every audit next to the SEO, performance and agent experience rules. See Fix SEO issues with AI for how an agent works through a report.

References

Check your site

Run squirrel audit https://example.com and open the Social Media section of the report. Each mismatch is reported with both URLs. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close