In today’s interconnected world, making your content accessible to a broader audience is key. For many long-standing blogs, this means embracing multilingualism. This article explores a successful journey of adding comprehensive multilingual support to a Hugo-built blog, focusing on practical strategies and Hugo’s powerful built-in features.
The motivation behind this endeavor was clear: while the blog (masutaka.net) primarily served a Japanese audience, the author frequently translated and cross-posted articles to platforms like dev.to, Hashnode, and Medium. To leverage the blog’s domain authority and improve SEO, the decision was made to host the original English versions directly on masutaka.net/en/ and set canonical URLs pointing back to the main site.
Hugo’s Seamless Multilingual Capabilities
One of Hugo’s standout features is its native support for multiple languages, requiring surprisingly minimal configuration. By simply adding a few lines to the config.toml
file, specifying defaultContentLanguage
and defining language blocks (e.g., [languages.ja]
and [languages.en]
), the framework is ready to handle different language versions. For instance, an English version of an article is easily created by appending .en.md
to the filename (e.g., content/posts/2025-08-15-1.en.md
). This setup automatically generates separate URLs for each language, such as https://masutaka.net/2025-08-15-1/` for Japanese and
https://masutaka.net/en/2025-08-15-1/` for English.
Strategic Implementation for SEO and User Experience
A critical aspect of this multilingual rollout was ensuring the preservation of existing URLs. Given the blog’s two-decade history, maintaining established links was paramount to avoid broken links and preserve SEO value. The strategy involved:
- Preserving Japanese URLs: The Japanese version of the site remained at its original paths, with the `/en/` prefix introduced exclusively for the English content. This ensured that `index.html`, `index.xml`, and `llms.txt` for Japanese stayed the same, while English counterparts gained the `/en/` prefix.
- Streamlined English Menu: To reduce maintenance and focus on content relevant to an international audience, the English menu was kept concise, featuring only “Archive,” “Tags,” and “Search,” omitting more Japanese-specific pages like “Device,” “History,” and “About.”
Behind the Scenes: Implementation Details
The core implementation involved a few key steps:
- `config.toml` Enhancements: Beyond basic language declarations, the `config.toml` was updated with language-specific menu items and parameters for each language, ensuring proper navigation and metadata.
- Creating English Static Pages: Essential static pages like Archives, Search, and Privacy Policy were duplicated and translated into English (`content/archives.en.md`, `content/search.en.md`, `content/privacy.en.md`). (Note: Symbolic links were not recognized by Hugo in this context).
- Dynamic Shortcodes: A custom `post` shortcode was enhanced to accept a `lang` argument. This allows generating links to articles in the current language by default or explicitly linking to a specific language version, greatly simplifying cross-language linking within content.
- Internationalization (i18n) for Partials: For phrases and UI elements within `layouts/partials/*.html`, dedicated `i18n/ja.toml` and `i18n/en.toml` files were created. This allowed for easy translation of UI strings using Hugo’s `i18n` function.
Conclusion: A Seamless Multilingual Transition
The transition to a multilingual Hugo blog was smoother than anticipated. Key successes included:
- Minimal Disruption: Existing Japanese URLs were completely preserved.
- Leveraging Hugo’s Power: The solution relied almost entirely on Hugo’s standard multilingual features.
- Efficient Maintenance: The simplified English menu helps manage content effectively.
- Automatic Multilingual Sitemaps: `sitemap.xml` and `llms.txt` automatically adapted for both languages.
With this robust multilingual foundation, the blog is now well-positioned to serve English-speaking readers, with the /en/
section acting as the primary source for English articles, which can then be cross-posted to other platforms. The increasing accuracy of AI translation tools further simplifies the process, making global content distribution more achievable than ever before.