HUGO

I18n: Option to build complete site despite missing front matter

Suggested feature
Adding a config setting that tells Hugo to generate files using the default language if the translated markdown file is missing. This is similar to how string translations currently work.

Background
To borrow from @nekr0z’s post, here’s an example:

content/
     page1.md
     page1.ru.md
     page2.md

Hugo generates me a nice site with Russian version in /ru/.

English version has a homepage, page1 and page2, all neat and clean, with menus and footers in English.

Russian version has a homepage and page1, all nice and clean, with menus and footers in Russian.

What I want is for Russian version to have a page2, too; with the content borrowed from English version untranslated, but with menus and footer in Russian.

There are two use cases where this makes sense:

  1. Sites using a Multilingual Multihost might completely be missing major parts of their translated content as it’s unlikely they’d translate into all languages before publishing every page.
  2. Sites using the default subdirectory example.com/es who are translating strings and front matter iteratively instead of all at once.

Some considerations

  • While there are ways to link to the default language’s content that’s not great for permalinks/SEO
  • Creating default language pages and pages that are “translated” according to a hreflang will be problematic for browsers automatically translating. But could be dealt with using Hugo functions like .File.Lang or .File.Dir
  • Perhaps another way to solve this would be a search in the CLI as we can do with i18n strings: hugo --i18n-warnings | grep i18n

What do y’all think? Is this something that would help more than the handful of us who have posted to the forum?

1 Like