Canonicals and hreflang solve different problems. A canonical identifies the preferred version of specific content. Hreflang connects pages serving equivalent intent in different languages or regions.
On a bilingual Astro website, the difficult part is not adding three <link> tags to the head. It is proving that every route points to the correct translation, that the translation points back and that canonicals, internal links and the sitemap agree.
Short answer: Each Greek and English page should normally be self-canonical. Both versions declare the same set of absolute
el,enand, when selected,x-defaultalternates. The build should fail when a counterpart or return link is missing.
Pair pages through route identity
Greek and English pages often have different slugs:
/ypiresies/texniko-seo/
/en/services/technical-seo/
Translating paths by replacing words is fragile. It does not know about exceptions, renamed routes or articles with entirely different slugs.
The Karastamatis Web Engineering website uses two forms of stable identity:
- route keys for primary pages and services,
- one shared
translationKeyfor the two Markdown entries of every article.
Language pairing therefore depends on a known data relationship rather than a guess based on the URL.
Keep each language self-canonical
A fully translated Greek page should not declare its English page as canonical. That would request canonical consolidation across two language versions and undermine the purpose of hreflang.
For the pair above:
<!-- Greek route -->
<link rel="canonical" href="https://example.com/ypiresies/texniko-seo/" />
<!-- English route -->
<link rel="canonical" href="https://example.com/en/services/technical-seo/" />
When hreflang is used, Google recommends specifying a canonical in the same language or the best available substitute language.
Declare the same alternate set on both pages
The Greek and English versions should contain the same set:
<link rel="alternate" hreflang="el" href="https://example.com/ypiresies/texniko-seo/" />
<link rel="alternate" hreflang="en" href="https://example.com/en/services/technical-seo/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/ypiresies/texniko-seo/" />
Each language version includes itself. If Greek points to English but English does not point back, the relationship is not reciprocal.
x-default does not automatically mean “primary language”. It identifies the URL intended for users when no specific language or region matches. On a site where the Greek home page is the genuine default experience, it may point there. A selector page or international landing page may require a different URL.
The minimum test matrix
For every route pair, a useful matrix is:
| Check | Greek route | English route |
|---|---|---|
| HTTP result | 200 | 200 |
| Document language | el | en |
| Canonical | Greek route | English route |
hreflang="el" | Greek route | Greek route |
hreflang="en" | English route | English route |
x-default | agreed default URL | the same default URL |
| Counterpart link | present | present |
| Sitemap | includes its canonical | includes its canonical |
The matrix tests relationships, not just tag presence. An hreflang="en" pointing to the English home page from every Greek service is valid HTML syntax but the wrong semantic pairing.
Translation needs real equivalence
Hreflang connects versions covering the same page intent. Sharing a template or translated navigation is not enough.
Before pairing two pages, check that they agree on:
- the service or primary subject,
- material claims,
- prices, timing and limitations where present,
- available functions,
- the CTA and actual next step.
Titles and paragraphs do not need to match word for word. Greek syntax should remain natural, and the English version should read as an independent page. The factual foundation, however, needs parity.
Draft or missing translation
When only one language version exists, there are two safe options:
- publish only the existing route with no false counterpart,
- keep both versions in draft until the pair is complete.
The Karastamatis Web Engineering blog uses the second approach for bilingual articles. A helper searches for a published entry with the same translationKey, and the build stops when it cannot find one.
An automatic fallback that displays a Greek body at an English URL can keep the route alive, but it creates a mismatch among the URL, navigation, lang, visible content and metadata. If framework fallback is used, redirect versus rewrite needs an explicit decision and a separate SEO review.
The sitemap should reinforce the same canonicals
Every indexable Greek and English route belongs in the sitemap under its absolute canonical URL. Redirects, 404 pages, noindex pages and staging URLs remain outside it.
Google accepts language alternates in HTML, HTTP headers or the XML sitemap. Maintaining all methods at the same time provides no Search benefit. On an Astro website where a shared layout reliably controls the head, HTML alternates are convenient to test with each page.
Sitemap inclusion is a weaker canonical signal than rel="canonical", but they should not conflict. If a page declares canonical URL A while the sitemap includes URL B, the release is sending inconsistent signals.
Automating the test
After astro build, a validator can create a map from canonical URL to generated HTML. For every page it:
- reads the document
lang, - extracts the canonical and all hreflang links,
- requires
el,enand the agreedx-default, - locates the counterpart page through the alternate URL,
- confirms that the counterpart returns a link to the original canonical,
- checks that both canonical URLs exist in the sitemap.
The test should compare normalised absolute URLs under one trailing-slash and host policy. Otherwise the same URL may appear different because one template generated a slash and another did not.
Failures that should block release
- every language page canonicalised to the home page,
- a Greek page canonicalised to its English translation,
- hreflang with no self-reference,
- a missing return link,
- an alternate URL returning a redirect or 404,
- a staging hostname in a canonical or sitemap,
x-defaultchanging between language versions,- a language switcher leading to a non-equivalent page,
- translated navigation around untranslated main content,
- a sitemap containing only one language.
Close the loop in production
The build confirms what Astro generated. After deployment, test the same URLs in production because redirects, CDN configuration or domain rules can change the final result.
For representative pairs, inspect response status, canonical host, HTML head, sitemap inclusion and language-switcher behaviour. After a domain, slug-architecture or localisation-policy change, rerun the complete matrix.