<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Spinlab Studio]]></title><description><![CDATA[Spinlab Studio]]></description><link>https://spinlab.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 21 Nov 2026 14:31:17 GMT</lastBuildDate><atom:link href="https://spinlab.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Hreflang Without Tears: Implementing Multilingual SEO for a Multi-Market Web App]]></title><description><![CDATA[Self-referencing, reciprocal and market-aware hreflang, generated from one source of truth]]></description><link>https://spinlab.hashnode.dev/hreflang-without-tears-implementing-multilingual-seo-for-a-multi-market-web-app</link><guid isPermaLink="true">https://spinlab.hashnode.dev/hreflang-without-tears-implementing-multilingual-seo-for-a-multi-market-web-app</guid><category><![CDATA[SEO]]></category><category><![CDATA[Next.js]]></category><category><![CDATA[i18n]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Robin Doelman]]></dc:creator><pubDate>Tue, 03 Nov 2026 07:12:05 GMT</pubDate><content:encoded><![CDATA[<p>When your site serves the same product in several languages <em>and</em> several regulated markets, hreflang stops being a nice-to-have. Get it wrong and Google shows the German page to Austrian users who are legally supposed to see a different terms page, or decides your translations are duplicates.</p>
<p>I learned this on casino front ends at Spinlab Studio, where markets genuinely differ by law; we publish the industry-specific versions of guides like this one (licensing, localisation, payments per market) <a href="https://spinlab.studio/blog">here</a>. Below is the framework-agnostic implementation.</p>
<h3>The three rules that matter</h3>
<ol>
<li><strong>Every page lists every alternate, including itself.</strong> Self-referencing is required.</li>
<li><strong>Links must be reciprocal.</strong> If <code>/de-at/</code> points to <code>/de-de/</code>, <code>/de-de/</code> must point back. One-way annotations are ignored.</li>
<li><strong>Use language-region codes only where content differs.</strong> <code>de</code> alone is fine if Germany and Austria get identical pages. Use <code>de-AT</code> / <code>de-DE</code> only when they don't.</li>
</ol>
<h3>Generating tags from one source of truth</h3>
<pre><code class="language-ts">// locales.ts
export const locales = [
  { code: "en",    path: "/en" },
  { code: "de-DE", path: "/de-de" },
  { code: "de-AT", path: "/de-at" },
  { code: "pt-BR", path: "/pt-br" },
] as const;

export function hreflangLinks(slug: string, origin = "https://example.com") {
  const tags = locales.map(l =&gt; ({ rel: "alternate", hrefLang: l.code, href: `${origin}${l.path}/${slug}` }));
  tags.push({ rel: "alternate", hrefLang: "x-default", href: `${origin}/en/${slug}` });
  return tags;
}
</code></pre>
<p>Render these in <code>&lt;head&gt;</code> on every localised route. In Next.js App Router, return them from <code>generateMetadata</code> via <code>alternates.languages</code>.</p>
<h3>When a page doesn't exist in every market</h3>
<p>This is the regulated-market twist: some pages (a promotion, a payment method) exist only in certain regions. Don't point hreflang at a 404 or a redirect. Filter the list per page:</p>
<pre><code class="language-ts">hreflangLinks(slug).filter(t =&gt; availableIn(slug, t.hrefLang));
</code></pre>
<h3>Checklist before shipping</h3>
<ul>
<li>Canonical on each page points to itself, not to the English version</li>
<li>No hreflang URLs that redirect, 404 or are noindexed</li>
<li>Sitemap and <code>&lt;head&gt;</code> annotations agree (pick one method if you can't keep both in sync)</li>
<li><code>x-default</code> points to a sensible fallback (language picker or global English page)</li>
</ul>
<p>Test with a crawler that reports reciprocal errors, then check Search Console's international targeting reports a few weeks later.</p>
]]></content:encoded></item></channel></rss>