Hello, first to post here and new in hugo.
I’m trying to migrate from middleman to hugo for my new project.
Just wonder, is there any ways i don’t need to specify markdown on different language on every page?
Indeed it adds much duplicates in my case, which our sites is indeed more in statistical & chart displayed, which we prefer to load the translated content thro i18n functions in .ace template, rather than specifying 10+ language .md files on each page.
We found that when we specified only one .md for the default language, only that particular languages will be built but other languages HTML will not be built indeed.
i.e. we specify contact.md
• then /contact & en/contact will have the page.
• while ja/contact, fr/contact will give a 404.
In user perspectives that is confusing and make the site easily have a broken page if many languages have to handle.
So… any ways we can only specify a default markdown. If a markdown of a particular language is missing, content will be loaded from the default markdown instead?
Welcome. How it works is pretty well described in the docs, so I’ll suggest reading over the relevant sections and then maybe making a small test site to prove it to yourself. I’ve got no middleman experience, so I can’t answer how it’s different, sorry.
Indeed i’ve read through quite several sources and I can’t make a default markdown loaded for a particular language if the markdown of that corresonding language don’t exists. That’s why I registered and asked my question here. I seldom need to raise question indeed but sadly this is the hurdle I came across and I still can’t find ways to go through. I need some supports or helps here…
In documentation so far I don’t see a single example illrustrating that. I wonder that may need some hacks here.
Or… Does Hugo only support multi-lingual by recognizing if there’s a corresponding .md file in the project only?
If you have a default, you should be able to set up the navigation (a language picker) to simply not show any language for which there is no translation. You’d pick a language as the default, then translate by making the other pages as you have translations. If visitors are writing the URL there is nothing you can do, but, if you simply make the dropdown not show any langs that don’t have translations, that would be ok, wouldn’t it?
You have the
lang.Merge function, but that only works for “page lists” (i.e. fill in the missing pages), but your problem isn’t currently supported.
Thx @bep for your reply… happy you reply is very informative and is very relevant to my question.
Yup further look into Lang.merge that serves the missing translation problem but sadly it cannot help in solving a missing markdown case.
No wonder why i tried several attempts but just we still can’t generate html on other languages if no corresponding locale markdown is specified on the project.
May I suggest and truly appreciated if missing markdown is supported later?
As I’ve mentioned, there maybe case quite often that one may prefer specifying ace/amber html templates and all l10n strings all stored in YAML so that’s more easily to manage.
I know Hugo is more focus on blogging template for for developments… just wish Hugo is willing to support more flexible towards other web developments & applications. Like in my case sure I keep in touch in react/vue web development but for security reasons & simplicity there’s usually cases we prefer SPA rather than a complex npm/react/vue development.
Actually… what JAMStack application needs is just HTML, CS, JS + AJAX for even a very complex scenario but just need your extensive knowledges among those.
Could this be solved with some combination of:
- blank files for missing translations, e.g.