This guide explains how to create and manage bilingual content using the automatic translation discovery system.
The multilingual system allows you to:
- Publish content in multiple languages (currently English and Spanish)
- Link related translations via shared IDs
- Keep secondary-language translations out of feeds, archives, category/tag indexes, Guided Path, and search (they stay reachable via direct URL + language toggle)
- Display language toggles for easy switching between versions
Use the same translationGroup value in both language versions:
# English version - featured in main listings
---
title: 'My Article'
language: ['en']
featured: true
translationGroup: 'my-unique-article-id'
---
# Spanish version - hidden from main listings
---
title: 'Mi Artículo'
language: ['es']
featured: false
translationGroup: 'my-unique-article-id'
---- Primary language: Set
featured: true(appears in listings) - Secondary language: Set
featured: false(discoverable via language toggle only) - Language array: Use
["en"]for English,["es"]for Spanish
Choose descriptive, unique IDs for translationGroup:
recovery-progress-reporttoddler-internet-safetycooking-fundamentals
When readers view a post with translations, they see:
🌐 Read in other languages:
🇺🇸 English | 🇪🇸 Español
The current language is automatically hidden from the toggle.
- Featured posts (
featured: true) appear in:- Homepage highlight masonry
- Category pages (as featured cards)
- Tag pages
- Non-featured English posts (
featured: false,language: ["en"]) remain in:- Category / tag / everything listings
- RSS/JSON feeds (primary-language feed content)
- Search
- Secondary-language translations (
featured: false, usuallylanguage: ["es"]) are:- Accessible via direct URL
- Discoverable via language toggle when
translationGroupis set - Excluded from RSS/JSON feeds,
/everything, category/tag indexes, Guided Path, and search (viaisListingEligiblePost/isFeedEligiblePost)
Guided Path always excludes Spanish posts (language: ["es"]), even if featured: true. Read Spanish via the language toggle on the English note.
Spanish-only orphans without an English pair stay indexable with correct lang="es" metadata; add a translationGroup only when a real pair exists. If a Spanish post should appear in category/tag/feed listings, set featured: true (Guided Path still omits it).
- LanguageToggle.astro: Displays available translations
- translationUtils.ts: Core translation discovery logic
- BlogLayout.astro: Integrates language toggle into post layout
The system:
- Finds all posts with matching
translationGroup - Filters out drafts and unpublished posts
- Generates language links with appropriate flags
- Displays toggle only when translations exist
All translation functionality is fully typed with TypeScript:
interface Translation {
id: string;
title: string;
language: string[];
path: string;
}
interface TranslationData {
translations: Translation[];
currentLanguage: string;
currentPath: string;
hasTranslations: boolean;
}- Choose primary language: Usually English for wider reach
- Consistent translation groups: Use descriptive, permanent IDs
- Complete translations: Ensure both versions are substantively equivalent
- Synchronized publishing: Publish translations together when possible
- Each language version has its own URL
- Proper
langattributes are set automatically - Search engines index both versions separately
- No duplicate content issues (different languages)
- Titles: Translate meaningfully, not literally
- Descriptions: Adapt for cultural context
- Tags: Use language-appropriate tags
- Images: Can be shared between versions
- Check
translationGroupvalues match exactly - Verify both posts have
published: true - Ensure neither post has
draft: true - Confirm
languagearrays are correctly set
- Only one version per translation group should have
featured: true - Secondary languages should always use
featured: false
- Translation toggle only appears when 2+ translations exist
- Check that posts share the same
translationGroup - Verify posts are published and not drafts
Planned features:
- Additional language support
- Language-specific RSS feeds
- Automatic translation status indicators
- Content synchronization tools
For issues or questions about multilingual content:
- Check this documentation
- Review example translation pairs in
/src/content/p/ - Submit issues via GitHub