Hyvor Blogs comes with in-built multi-language support. This guide will help you to set up languages of your blog correctly. Language settings are located at Settings → Languages.
English (en) is the primary language for newly created blogs. If you are blogging in a different language, it is important to change the language in Language settings to tell users, browsers, and crawlers the language of your blog.
Each language in your blog has a code, name, and a direction.
en
en-US
en-GB
fr
fr-FR
Everything in Hyvor Blogs is designed to support multiple languages. Most of the texts can be translated from the Console UI while some texts (like the texts in the theme) should be translated in YAML files.
Go to Settings → Languages and click Add Language button to add a new language.
When you add a new language, all posts will be translatable to that language. The non-primary languages will have index pages, for example, /fr
for French. All routes of your blog will be available in the new language in the same format.
In the post editor, you will now see an option to switch between languages. When you switch to a new language for the first time in a post, a new draft "variant" will be created.
Then, you can translate your post content, title, slug, and description to the new language. If you use the slug bonjour-monde
for the French variant, the URL of the post will be /fr/bonjour-monde
.
All data in your blog can be translated. For example, the blog name, description, navigation anchors, etc. Here are the places you can translate data.
Translatable settings will have a UI like this. First, create a variant, then translate the data.
All official themes are built with multi-language support. You can translate the theme texts in YAML files.
lang
folder. en.yaml
is the default language file.en.yaml
file.fr.yaml
for French. Then, paste the copied contents to the new file.key: value
pairs.*
and {key}
are placeholders. Do not translate them.:
, *
, etc.Example:
en.yaml
comments: Comments
posts_num_multi: "* Posts"
author: "by {name}"
fr.yaml
comments: Commentaires
posts_num_multi: "* Articles"
author: "par {name}"
Here are some under the hood works that Hyvor Blogs do to make sure search engine robots understand your multi-language pages. You don't need to do anything for these.
HB adds the lang attribute to the <html>
tag in all pages using the language code you set (this is why using the correct language codes are important).
<html lang="en">
In addition, HB will add hreflang
alternate tags. For example, if you have three languages (en
, fr
, es
), the en index page (/) will have these tags.
<link rel="alternate" href="https://yourblog.com/fr" hreflang="fr" />
<link rel="alternate" href="https://yourblog.com/es" hreflang="es" />
For posts, we will add these alternate tags only if the translated variants are published.