Small SEO Tools

How to Check Whether a Canonical Tag Is in the Head

Finding rel="canonical" somewhere in a page’s source does not establish that the page has a canonical link in its head. The text might belong to a link pasted into article content or to an escaped code example. Check the actual element and its location before changing the chosen URL.

This guide checks HTML canonical link placement. It uses a fictional seed-storage page and controlled local browser documents; it does not test which canonical Google selects.

Check the existing declaration before adding another

Open the public page and inspect its delivered source and rendered document. Find the integration or template that supplies its metadata. A CMS theme or SEO integration may already emit the intended canonical, even if an editor also contains a pasted example.

Google’s canonical implementation guidance says an HTML canonical link is accepted only in the head section, which must be valid HTML. A matching link in the body does not meet that requirement.

Keep the intended destination in your review notes. The canonical URL comparison guide covers choosing a target when tracking parameters open the same content. This walkthrough focuses on where the declaration ends up.

Generate one line for a placement example

  1. Open the Meta Tag Generator.
  2. Enter Seed storage guide in Page title and Store seeds in labelled paper packets and compare the example storage notes. in Meta description.
  3. Enter https://example.com/guides/seed-storage/ in Canonical URL.
  4. Leave the optional social-tags checkbox off and select Generate Meta Tags. Locate this line in the output:
<link rel="canonical" href="https://example.com/guides/seed-storage/">

The generator creates markup from the entered values. It does not fetch the fictional target, install the line in your page or confirm the metadata’s final location. Keep this exercise separate from the full metadata block already managed by your site.

Inspect actual elements inside document.head

On the page being reviewed, run this browser-console expression:

[...document.head.querySelectorAll('link[rel~="canonical"]')]
  .map(link => link.href)

MDN documents document.head as the current document’s head element. Scoping the query there distinguishes a head declaration from a similar element elsewhere.

We generated the line with the unchanged current tool code, then placed that exact line in three native Chrome documents. A separate HTML parser checked actual start tags and their head or body section:

Document setup Actual canonical links anywhere In the head In the body
Link element inside the head 1 1 0
Same link element pasted into the body 1 0 1
Escaped line displayed in a code block 0 0 0

A source-text search could find rel="canonical" in all three inputs. Only the first had a canonical link in the head. The console expression returned one URL for that case and an empty array for the other two. The escaped code case displayed the line as text without creating a link element.

These are placement observations from controlled documents. The head result does not by itself verify the target’s content, the rest of the metadata or a search engine’s canonical selection.

Correct the existing output and recheck the public page

  1. Use the current metadata provider. If its output is missing or misplaced, repair that CMS setting or head template. An article-content HTML block is not a page-head setting.
  2. Keep one intended HTML declaration. If the head already contains the correct link, retain it and review any redundant pasted body markup.
  3. Reload the public page. Check the delivered source, rerun the head query and compare the returned address with your approved target. Review the rendered document too if scripts add metadata.
  4. Check the shared template. Repeat on another affected page so that one successful example does not hide a broader placement problem.

The console checks HTML elements only. A canonical Link response header is a separate mechanism; review the HTTP response if the site uses one. Our canonical header guide demonstrates that distinction for a PDF. Keep the chosen implementation consistent. Correct placement supplies a declaration; it does not guarantee the URL Google ultimately chooses.