Hugo Multilingual Collection Translation: Solving the Language Switcher Issue With Different Display Names

Contents

The Problem

In FixIt theme, collections are a custom taxonomy. If Chinese and English posts use different collection names:

# zh-CN
collections: ["Podman 教程"]

# en
collections: ["Podman Tutorial"]

The language switcher on /collections/ pages and post pages disappears. Hugo treats them as two separate taxonomy terms, so .IsTranslated and .AllTranslations return nothing.

Currently using Hugo v0.160.1.

The Solution

The approach is straightforward: use the same collection name across all languages, and let _index.md provide localized display titles.

Take the podman-tutorial collection as an example. Create:

content/collections/podman-tutorial/
├── _index.zh-CN.md
└── _index.en.md

_index.zh-CN.md:

---
title: "Podman 教程"
---

_index.en.md:

---
title: "Podman Tutorial"
---
  • Both languages share the URL /collections/podman-tutorial/ (determined by the directory name)
  • The Chinese display name is “Podman 教程”
  • The English display name is “Podman Tutorial”
  • No translationKey needed - same term name, Hugo auto-links them

Post Configuration

Both language versions use the same collection name in frontmatter:

# xxx.en.md
collections: ["podman-tutorial"]

# xxx.zh-CN.md
collections: ["podman-tutorial"]

That’s it. The language switcher will work normally across all collection pages and posts.

Edit this page

Contents