← Build Journal

Content Collections for trilingual Astro sites

How to structure Astro Content Collections to publish posts in Portuguese, English, and Spanish without losing editorial control.

Content Collections are one of Astro’s strongest features for treating content as structured data. In a trilingual site, they help keep discipline: each post needs a title, description, language, category, canonical URL, reading time, and consistent metadata.

Without that contract, the blog grows quickly, but becomes a folder of files that are hard to audit and trust.

The folder structure

A simple structure already solves a lot:

  • src/content/blog/pt
  • src/content/blog/en
  • src/content/blog/es

Each language stays isolated, but all of them share the same collection. That makes it possible to filter by prefix, sort by date, and reuse the same card, article, and related-post components.

The key is not mixing the editorial decision with the public route. The folder indicates the language. The slug indicates the URL. The canonicalId connects translations.

The schema as a contract

The collection schema is the quality gate. It enforces required fields and prevents an incomplete post from breaking the site later.

Important fields for a trilingual blog:

  • language
  • canonical
  • canonicalId
  • displayDate
  • backLabel
  • tocLabel
  • sourcesHeading
  • toc
  • sources

When these fields are validated, the layout can trust the data. That reduces conditionals scattered across components and makes automation more predictable.

Routes separated by language

The pages can stay simple:

  • /blog/[slug] for Portuguese.
  • /en/blog/[slug] for English.
  • /es/blog/[slug] for Spanish.

Each route filters only posts from its own language and uses the same function to generate URLs, related posts, and alternates.

This design avoids a complex international router too early. For a static personal or editorial site, clarity is more valuable than premature sophistication.

How this scales

When volume increases, the structure still works. New posts enter as files. New languages can get new folders. Automations can generate frontmatter while respecting the schema.

The main point is that content stops being improvised. It becomes a readable, versioned base ready to be fed by a pipeline with n8n, Baserow, or any other editorial backend.

Documentation