SkuParity

TECHNICAL GUIDE · HTML5 DOMPARSER · SHOPIFY SEO

Why Shopify apps close </head> early and push canonical into <body>.

In View-Source everything looks fine—yet Googlebot ignores your rel="canonical", hreflang, and meta description because a single misplaced tag inside theme.liquid forced Chromium to end <head> early.

1 · THE HTML5 SPECIFICATION RULE

One body-only tag inside <head> breaks every tag below it

Per the WHATWG HTML5 parsing algorithm implemented by Chromium and Googlebot, encountering any non-metadata tag (<input>, <div>, <span>, <img>, <iframe>, <p>) inside <head> immediately generates an implicit </head><body> transition.

Common Culprit #1

Hidden <input> from Tracking Apps

App embeds rendered inside content_for_header or above {% render 'meta-tags' %} inject hidden inputs that terminate <head> on line 40.

Common Culprit #2

Tracking Pixels (<img>)

An unwrapped <img height="1" width="1"> pasted outside <noscript> inside theme.liquid breaks canonical tags on every page of the store.

Why Regex Misses It

Chromium DOMParser Proof

SkuParity parses raw public HTML inside isolated Chromium without third-party JS to prove the exact line number where </head> collapsed.

2 · FIXING THEME.LIQUID CLEANLY

Move injected HTML elements inside <body> or <meta>

layout/theme.liquid

// Keep strictly metadata tags inside <head> before canonical & hreflang
- <head> ... <input id="sellerDomain" type="hidden" value="...">
+ <head> ... <meta name="seller-domain" content="...">
+ <link rel="canonical" href="{{ canonical_url }}">
+ </head><body> <!-- Move any <div>, <input> or <img> snippets here -->

Verify your Shopify theme before and after every release

Run a free read-only Discovery Audit (€0) with zero Shopify admin access, or automate weekly checks for up to 10 client stores with the Agency Pack (€199/mo).