844 words
4 minutes

Hreflang for Independent Multilingual Content: When Pages Are Not Translations

2026-07-31
2026-08-01
Marketing
SEO
/
hreflang
/
i18n
/
Astro

An English article and a Traditional Chinese article can cover the same technology without being localized versions of the same page. Connecting them with hreflang anyway sends a stronger equivalence signal than the content supports.

For a multilingual technical blog with independently planned articles, the safe default is a self-canonical page with no hreflang. Add reciprocal alternates only when the two URLs genuinely represent the same article for different language audiences.

Canonical and hreflang answer different questions#

A canonical link identifies the preferred URL for the current page:

<link
rel="canonical"
href="https://example.com/en/posts/pagefind-multilingual-search-astro/"
>

An hreflang alternate identifies another localized version of the same content:

<link
rel="alternate"
hreflang="zh-Hant"
href="https://example.com/posts/pagefind-multilingual-search-astro/"
>
<link
rel="alternate"
hreflang="en"
href="https://example.com/en/posts/pagefind-multilingual-search-astro/"
>

Google Search Central describes hreflang as a way to identify localized variations of a page. It also expects every version to list the other versions, including itself. A one-way link is not a complete relationship.

The canonical on each localized page should normally point to that page itself. Do not canonicalize an English translation to the Traditional Chinese original; doing so conflicts with the intent to index both language versions.

Decide whether two articles are equivalents#

Use content intent, not shared tags, to make the decision.

RelationshipSelf-canonicalReciprocal hreflang
Direct translation with the same examples and purposeYesYes
Localized adaptation with the same reader task and equivalent main contentYesYes
Two tutorials about Astro with different problemsYesNo
English article inspired by a shorter Chinese noteYesNo
Only one language version existsYesNo

For example, an English guide about preserving legacy URLs and a Chinese post about generating an Astro sitemap both belong to an Astro/SEO cluster. They are useful internal links, but they are not language alternatives. Each should remain self-canonical without an hreflang connection.

Represent translation as optional content data#

Folder names and matching slugs are weak evidence of equivalence. Use an explicit optional key in the content schema:

const postsCollection = defineCollection({
schema: z.object({
title: z.string(),
lang: z.enum(["en", "zh-TW", "zh_TW", ""]).optional(),
translationKey: z.string().trim().min(1).optional(),
}),
});

Independent articles omit translationKey. A verified pair receives the same value:

# Traditional Chinese article
lang: zh-TW
translationKey: astro-i18n-routing
# English article
lang: en
translationKey: astro-i18n-routing

This model makes the editorial decision visible and reviewable. It also allows translated titles and different slugs without relying on filename equality.

Build alternates only for complete pairs#

Group posts by non-empty translationKey, then require one unambiguous entry for each supported locale.

type Locale = "zh-TW" | "en";
for (const post of posts) {
const key = post.data.translationKey?.trim();
if (!key) continue;
const locale = normalizeLocale(post.data.lang);
const group = groups.get(key) ?? new Map<Locale, Post>();
if (group.has(locale)) {
throw new Error(`Duplicate translation key: ${key} (${locale})`);
}
group.set(locale, post);
groups.set(key, group);
}

When a group has both zh-TW and en, create two alternates and pass them into the page layout. When only one side exists, emit nothing. This avoids publishing a relation to a missing URL.

The resulting Astro layout can render absolute URLs:

{alternates.map((alternate) => (
<link
rel="alternate"
hreflang={alternate.hreflang}
href={new URL(alternate.path, Astro.site).href}
/>
))}

Fail the build when the same locale uses one translation key twice. Choosing the first match would make the output depend on collection order and could connect the wrong article.

Keep independent English articles unpaired#

For an English-first experiment, it is acceptable for every initial article to have no equivalent Chinese page. Give each English URL:

  • an absolute self-canonical containing /en/posts/;
  • html lang="en";
  • BlogPosting.inLanguage set to en;
  • its own English title, description, and body;
  • no article-level hreflang until an equivalent page exists.

These technical boundaries work alongside the URL and query design in Build an Astro Multilingual Blog Without Migrating Existing URLs. If the site uses Pagefind, the same root language value can also keep multilingual search results separated.

Verify the generated HTML#

Check output files after the production build. Source components cannot prove which conditional tags were rendered.

Terminal window
pnpm build
rg 'rel="canonical"' dist/en/posts
rg 'hreflang=' dist/en/posts
rg '"inLanguage":"en"' dist/en/posts
rg '/en/posts/en/' dist

For a pilot containing only independent English articles, the hreflang search should return no matches. The double-prefix search should also be empty.

If you later add a translation pair, inspect both generated pages and verify that:

  1. both pages remain self-canonical;
  2. both list the English and Traditional Chinese alternates;
  3. alternate URLs are absolute and return successful pages;
  4. no third page shares the key in either locale.

The editorial test comes before the markup test: if two articles do not solve the same reader problem with equivalent main content, do not pair them. A shared topic is an internal-link relationship, not automatically a language-alternate relationship.

FAQ#

Q: Does every page on a multilingual site need hreflang?#

A: No. A page needs hreflang only when another URL is an equivalent localized version for a different language or region. A multilingual site can contain many independent self-canonical pages with no alternate relationship.

Q: Should an English translation canonicalize to the original article?#

A: Normally, no. If both localized pages are intended to be indexed, each should use a self-canonical URL and list the reciprocal language alternates. Canonicalizing the English page to the original sends a conflicting consolidation signal.

Q: Should I publish hreflang when only one side of a translation pair exists?#

A: Wait until both localized URLs exist and can reference each other. An incomplete one-way relationship does not represent a complete alternate set, so the safer output is no article-level hreflang until the pair is ready.

References:

Google Search Central: Tell Google about localized versions of your page

Hreflang for Independent Multilingual Content: When Pages Are Not Translations
https://laplusda.com/en/posts/hreflang-independent-multilingual-content/
Author
Zero
Published at
2026-07-31
License
CC BY-NC-SA 4.0
Was this article useful?

Report a typo or broken link, or suggest a related topic.