Today, with the deepening of globalization, many enterprises and content operators need to provide customized content for users in different languages or regions. In order to ensure that these multi-language versions can be correctly identified by search engines and displayed to the target users,hreflangThe correct setting of tags is particularly important. For friends who use AnQiCMS to build multilingual websites, the built-in systemlanguagesTags are a powerful tool to solve this problem.

UnderstandinghreflangThe importance of tags.

Before we delve deeper into how AnQiCMS helps us set things up.hreflangLet's take a look back first.hreflangThe role of tags. In simple terms,hreflangTags are signals to search engines that "this page has other language or regional versions.hreflangYou can tell search engines like Google:

  • example.com/zh/productIs in Chinese version
  • example.com/en/productIs in English version
  • example.com/jp/productIs in Japanese version

Correct settingshreflangSeveral significant benefits include:

  1. Avoid issues with duplicate content:Search engines will not treat content in different languages as duplicate, which can affect rankings.
  2. Enhance user experience:Search engines can automatically guide users to the most suitable language version of the page based on their language preferences and geographic location, reducing the bounce rate.
  3. Optimize international SEO:Ensure your content can accurately reach the target audience of different global markets.

AnQiCMS, a system designed specifically for multi-site management and multilingual promotion, naturally willhreflangThe implementation considerations are taken into account, and a concise and efficient solution is provided.

How AnQiCMS Simplifies Multilingual SEO:languagesTags Take the Stage

AnQiCMS has fully considered the needs of multi-language content management from the very beginning.It supports the switching and display of multilingual content, which can help operators easily expand into international markets.In the background 'Multi-site Management', we can configure sites in different languages, set their language packages and corresponding access addresses.hreflangThe generation of tags provides basic data.

In the AnQiCMS template system,languagesTags are specifically used to retrieve the list of all configured multilingual sites.This tag does not accept any parameters, and upon execution, it returns an array object containing information about all language sites.hreflangrequiredlinkLabel.

Practical: Configure tags in AnQiCMS templates,hreflangtags

hreflangare usually placed in the HTML document's<head>Within a block. In AnQiCMS, this means you need to be in the public header file, usuallybase.htmlor a similar template file to configure it, to ensure it applies to all related pages.

Let's take a look at a specific example of template code:

{%- languages websites %}
{%- for item in websites %}
<link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
{%- endfor %}
{%- endLanguages %}

The core logic of this code is:

  1. {%- languages websites %}: To calllanguagesTags, assign information of all multilingual sites towebsitesvariables. Of whichwebsitesis an array object.
  2. {%- for item in websites %}: Iterate overwebsiteseach element in the arrayitemEach,itemrepresents a language site.
  3. <link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">: This is a generatedhreflangtag's key.
    • rel="alternate": This indicates it is a backup version.
    • href="{{item.Link}}":item.LinkDynamically outputs the complete link address of the current page on the corresponding language site. AnQiCMS intelligently handles this part to ensure that the link points to the correct language version page.
    • hreflang="{{item.Language}}":item.LanguageIt will output the language code of the site, for examplezh-cn(Simplified Chinese),en-us(American English) ordeGerman and others. These language codes need to be correctly configured in the language package settings of the AnQiCMS backend.

Through the above code, AnQiCMS will automatically generate the corresponding language versions for all configured languages on the current page.hreflangFor example, if you have a Chinese pageexample.com/zh/page1and configured the English siteexample.com/en/page1thenexample.com/zh/page1of<head>will appear with a linkexample.com/en/page1ofhreflangtags, and vice versa.

Ensurehreflangsome considerations for setting up correctly

[en]It is not enough to just add the code to the template, we also need to pay attention to several key points:hreflang[en]To make the tags work effectively, we also need to pay attention to several key points:

  1. [en]The accuracy of the site language code: item.LanguageThe language code must comply with the ISO 639-1 standard. If regional information is required, it should be combined with the ISO 3166-1 Alpha 2 country code (e.g.en-gbIndicates British English. Make sure to correctly select the "Default Language Pack" in the "Global Function Settings" of AnQiCMS.
  2. All language version pages must includehreflang:Each page that exists in multiple languages should include links to its own version and all other language versionshreflangtags. AnQiCMS'slanguagesTags are designed for this, it will traverse all language sites.
  3. Bidirectional reference:If page A points to page B, then page B must also point to page A. This bidirectional reference ishreflangThe foundation that ensures the engine fully understands your multilingual structure.
  4. x-defaultUsage of tags (optional but recommended):Although AnQiCMS'slanguagesLabels are mainly used to generate links for specific language versions, but to provide a "default" or "fallback" version, you may consider adding an extra onex-defaultTag.This tag tells the search engine which page should be displayed when the user's language or region does not match any specified version.x-default:
    
    <link rel="alternate" href="{% system with name="BaseUrl" %}" hreflang="x-default">
    
    Here are the{% system with name="BaseUrl" %}Used to obtain the base URL of the current site.
  5. Content consistency:Ensure that the content in different language versions is an accurate translation of the corresponding language, not machine translation or low-quality content. High-quality multilingual content ishreflangthe root of success.
  6. Testing and verification:After configuration, be sure to use tools like Google Search Console for verification, checkhreflangwhether the tags are recognized correctly and there are no errors.

By fully utilizing the multi-language support features of AnQiCMS,languagestags,