SEO - Hreflangs
General Information
If you run a Magento store that serves more than one country or language, hreflang is the most important and the most-easily-broken SEO signal you ship. Get it right and Google routes French speakers to your .fr store and German speakers to your .de store. Get it wrong — broken alternates, missing reciprocals, hreflang on non-canonical URLs — and Google quietly disregards the entire cluster, surfacing the wrong language to half your audience.
The Qoliber SEO Hreflangs extension generates hreflang link tags automatically for every store view your products, categories, CMS pages, contact form and homepage are visible on. No manual maintenance, no dev effort to wire up new store views, and the hard cases — x-default, canonical awareness, broken-alternate filtering — are handled for you.
What Does This Extension Do?
- Emits hreflang link tags for products, categories, CMS pages, the homepage and the contact page across every store view.
- Automatic locale conversion — Magento locale codes (
en_US,pl_PL) become hreflang-format codes (en-us,pl-pl). x-defaultsupport — designate a store view as the fallback when none of the user's languages match.- Per-store skip list — exclude store views from hreflang clusters when they shouldn't participate (e.g., a wholesale-only store view that shouldn't be advertised to retail).
- Canonical-aware — hreflang tags are suppressed on filtered, sorted and paginated URLs so Google's canonical signal isn't diluted.
- Broken-alternate filtering — store views that can't resolve a URL for the current entity are dropped silently, not emitted as
<link href="">. - Per-page-type resolvers — separate URL resolution logic for products, categories, CMS pages, the contact form and the homepage. Edge cases handled per type.
- Checkout exclusion — hreflang is removed from the checkout flow via layout XML; never advertised on transactional pages.
Why Is This a Game Changer?
- No hand-curated lists. Every store view is auto-included. Add a new store view in admin, hreflang clusters update on the next page render — no developer touch required.
- Google won't ignore your cluster. Reciprocal coverage, canonical awareness, valid
x-default: the three things that cause Search Console to drop a hreflang cluster are all handled for you. - Plays nicely with
SeoAdvancedSitemaps— hreflang annotations also flow into your sitemaps, the second place Google looks for cluster signals. - Hardened against XSS. Locale codes and URLs are properly escaped with
escapeHtmlAttr()andescapeUrl()— a class of bug that has plagued other Magento hreflang modules historically.
How Does It Work?
For each request, the module:
- Determines the current entity (product / category / CMS / contact / homepage).
- Walks every active store view and asks the per-type resolver for the equivalent URL.
- Drops store views in the skip list and store views that returned no URL.
- Emits one
<link rel="alternate" hreflang="…" href="…">per surviving store view, plus one<link rel="alternate" hreflang="x-default" href="…">if configured.
The result is a complete, reciprocal, canonical-clean hreflang cluster on every page that should have one — and nothing on pages that shouldn't.
Configuration at a glance
Find the module under Stores → Configuration → Qoliber → SEO: HrefLangs. Pick your x-default store view, optionally add per-cluster skip lists, and you're done.
What's New in 2.1
- Critical XSS fix — removed
/* @noEscape */directives in templates; locale and URL fields now pass throughescapeHtmlAttr()/escapeUrl(). - Canonical-aware suppression — no hreflang tags emitted on URLs with filter, sort or pagination query parameters; preserves the canonical signal Google needs.
- Broken-alternate filtering — store views that can't resolve a URL are dropped instead of emitting
<link href="">(which Search Console flags as a malformed cluster).