Configuring Multi-Language Website SEO with Hugo


Translating your Hugo website can improve your Google and Bing ranking – but only if the translated content is high quality, localized, and properly structured for multilingual SEO.

Localized pages (not just translated, but culturally adapted) often reduce bounce rates, increase time-on-site and improve conversions. These are user behavior signals that can positively affect your SEO rankings.

Hugo is a static website generator. In the essence it converts the Markdown files to Html pages in a very configurable way and is pretty fast. For the details please see here



Main question: Should You Translate for SEO?

reasons table



Required HTML for sites with literal (automated) translations

  1. Each page must have lang attribute in html tag, for example:

Enter fullscreen mode

Exit fullscreen mode

  1. Each page must have list of alternative links for this page in other languages, for example, html below is descibing alternative urls for same or similar page in three languages:
 rel="alternate" hreflang="en" href="https://www.glukhov.org/post/2025/10/multi-language-website-seo-with-hugo/">
 rel="alternate" hreflang="de" href="https://www.glukhov.org/de/post/2025/10/multi-language-website-seo-with-hugo/">
 rel="alternate" hreflang="ru" href="https://www.glukhov.org/ru/post/2025/10/multi-language-website-seo-with-hugo/">
Enter fullscreen mode

Exit fullscreen mode

  1. Each translated website page must specify canonical url for this page (the one in first or language of original page), like:
 rel="canonical" href="https://www.glukhov.org/post/2025/10/multi-language-website-seo-with-hugo/">
Enter fullscreen mode

Exit fullscreen mode

This will advise search engines to skip indexing non-canonical pages.
Some search engines of course can ignore this, and index all pages.



For professionally / manually translated web page

Not specifying can cause search engine to impose duplication penalties.
But if you do manual translation of your website pages, or order professional one, you can hope search engines would accept your non-canonical page as original.



Hugo templates for localized websites

We should keep in mind that the Hugo website theme
might be supporting all this already.




Open file layouts/_default/baseof.html either in your Hugo website folder or your theme’s folder and make sure there is something like:

</span>
 class="no-js" lang="{{ .Site.Language.Lang }}">

...
    {{ partial "seo-localise.html" . }} 

...
Enter fullscreen mode

Exit fullscreen mode



and

Now open file layouts/partials/seo-localise.html and put there this html template code:

{{ $defaultLang := .Site.Params.defaultContentLanguage | default "en" }}
{{ $canonical := .Permalink }}

{{ if .IsTranslated }}
  {{ $original := .Translations.GetByLang $defaultLang }}
  {{ if $original }}
    {{ $canonical = $original.Permalink }}
  {{ end }}

{{ end }}


 rel="canonical" href="{{ $canonical }}">


{{ range .AllTranslations }}
     rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
{{ end }}
Enter fullscreen mode

Exit fullscreen mode

If you translate your website manually, this code might be looking like

{{ $canonical := .Permalink }}


 rel="canonical" href="{{ $canonical }}">


{{ range .AllTranslations }}
     rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
{{ end }}
Enter fullscreen mode

Exit fullscreen mode

Now execute hugo command to generate a website, then hugo serve to run developer web site host, open website and view a page source.
Make sure all those and tags have proper attributes.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *