Sometime ago I shared with you a link to my website where I looked into implementing hreflang and x-default tags into my personal website, where not all the content were translted.
Since then, I made yet another Hugo website and need to re-think this approach for this specific site where there are 3 languages available and all content is translated.
Here, with @jmooring knowledge in the post
I get to the point where I find a solution for my new project.
See more for details:
The code for use in Hugo, for these who don’t have time to read it
<link rel="alternate" hreflang="{{ .Language.LanguageCode }}" href="{{ .Permalink }}">
{{ range .Translations -}}
<link rel="alternate" hreflang="{{ .Language.LanguageCode }}" href="{{ .Permalink }}">
{{ end -}}
{{ $p := index (where .AllTranslations "Language.Lang" "en") 0 }}
<link rel="alternate" href="{{ $p.Permalink }}" hreflang="x-default">