HUGO

Single markdown for multiple languages

We have a multilingual site. Our Translation-Dropdown in our Navigation-partial looks like so:

    <ul>
        {{ range .Translations }}
        <li>
            <a href="{{ .Permalink }}">{{ .Lang }}</a>
        </li>
        {{ end }}
    </ul>

For the most pages this works fine:

  • /site/content/about/_index.en.md
  • /site/content/about/_index.md

We can easily navigate between english and our default language.

Now to the problem. Our blogposts are in english only:

  • /site/content/blog/helloworld/index.en.md

Meaning, that there is no translation to our default language. Meaning, there is no button, as the iteration I showed before is now empty as there are no translations. This also means that the rest of the page is shown in the english language. Including header and footer and the url-slug and so on.

This is very inconvenient as you automatically switch to the english language when you click on that blogpost - we want to stay on the default language, but with the english blog-post.

An easy solution to this would be to just copy the index.en.md to index.md. This would work. But it would also be very inelegant as you would have to author the content twice everytime you want to change something.

An even better solution would be to create a symbolic link. You’d only have to author the content once.

But I really wonder if hugo does not provide something for this problem which, I could imagine, occurs very often?

thanks for your help

I have asked a similar question a couple of months ago, and it looks like symlinking is the way to go. Some other options with pros and contras were mentioned it that tread, too.