WordPress - How does Weglot manage your website's SEO?
In this article, you’ll learn how Weglot manages your website’s SEO and helps Google discover and index all translated versions of your website.
To make your translated pages visible to search engines, Weglot follows multilingual SEO best practices, including:
Multilingual SEO best practices, as recommended by Google, require several key elements. Weglot manages these elements automatically.
1. Creating a unique URL for each translated version of your web pages
Google needs a separate URL for each language version of your page. This allows Google to identify, crawl, and index each translated version individually.
Weglot automatically creates a /[2-letter-language-code] subdirectory for each translated version of your pages.
|
E.g. German version of the webpage below:
|
E.g. Spanish version of the webpage below:
|
2. Adding hreflang tags for Google indexing bots
Weglot automatically adds hreflang tags to your website’s source code.
Hreflang tags are used to tell Google that different language versions of the same page exist. They help Google understand the relationship between these pages and display the most relevant version to visitors, depending on their language or region.
You can find these hreflang tags inside the <head> tag of your website’s source code.

With this method, you don’t need to manually edit your sitemap.
The x-default tag
The x-default hreflang tag is not necessary for most websites and is not added by Weglot by default.
This tag is used to indicate which version of your website should be shown to users whose language or region is not specifically covered by the other hreflang tags.
For example, x-default can be useful for a homepage that acts as a language selection page and does not target one specific language.
Most websites do not need this tag. However, if you want to add it to your website, you can do so using the PHP filter below.
You can add this snippet with a plugin such as Code Snippets, or directly in your functions.php file:
add_filter( 'weglot_href_lang', 'custom_weglot_href_lang' );
function custom_weglot_href_lang( $render ) {
$relativeURL = $_SERVER['REQUEST_URI'];
$render = "<link rel=\"alternate\" href=\"https://your-website-url" . $relativeURL . "\" hreflang=\"x-default\"/>" . $render;
return $render;
}
You’ll need to replace:
https://your-website-url
3. Having content translated into the source code
4. Detecting and translating your website’s SEO tags
Weglot automatically does that on the server side again.
|
E.g. Meta-description for the English version of the website:
|
|
E.g. Meta-description for the Kazakh version of the website:
|
For example, if your original page has an English meta description, Weglot can provide a translated meta description for each translated version of that page.
Weglot also translates the alt attributes of <img> tags. These attributes correspond to the alternative text displayed when an image cannot be rendered, and they can also help search engines understand image content.



