How to implement content switching and display on the page for AnQiCMS multilingual support?

How to implement multilingual content management in AnQiCMS?

One of the core features of AnQiCMS is its support for multi-language content switching and display, which greatly meets the needs of enterprises and content operators in global promotion.The value of its users lies in the ability to help enterprises easily expand into international markets, allowing website content to directly target users of different languages.

Generally, to achieve full multilingualization of website content, operators will combine the "Multi-site Management" feature of AnQiCMS.Set up an independent site for each target language, each site maintains all the content of the corresponding language.For example, a main site uses Chinese, and then a sub-site or an independent domain name site is created to carry English content, all of which can be efficiently managed on the unified background of AnQiCMS.

Displaying language switching functionality on the page

How to provide an intuitive language switch option on the website front end after your AnQiCMS site is configured with multiple language versions, which is a key step to improve user experience. AnQiCMS provides for thislanguagesLabel, this is a convenient tool used to obtain a list of multi-language sites that have been configured.

BylanguagesLabel, you can easily iterate through all language versions in the template and create clickable switch links. This label will return an array object that contains key information for each language site, such asLanguageName(language name),Language(Language codes such as en-US, zh-CN),Link(URLs corresponding to language sites) etc.

The following is an example code snippet for adding a language switcher on a website page, which dynamically generates links to various language versions:

<nav class="language-switcher">
    <span>切换语言:</span>
    {%- languages websites %}
    {%- if websites %}
        <ul>
        {%- for item in websites %}
            <li>
                <a href="{{item.Link}}" {% if item.Language == currentLanguage %}class="active"{% endif %}>
                    {# 如果有语言图标,显示图标;否则显示表情符号或语言名称 #}
                    {%- if item.LanguageIcon %}<img src="{{item.LanguageIcon}}" alt="{{item.LanguageName}}" />{%- else %}{{item.LanguageEmoji}}{% endif %}
                    {{item.LanguageName}}
                </a>
            </li>
        {%- endfor %}
        </ul>
    {%- endif %}
    {%- endLanguages %}
</nav>

In this example,websitesThe variable carries all the language site data provided by AnQiCMS. Byforlooping, we create an attribute for each language version.<a>tag, itshref pointing to the corresponding language site link (item.Link)LanguageNameIt serves as the user-visible language name. We also added aactiveclass name to highlight the language version being accessed by the current user.

Optimize SEO: Hreflang Tag Application

For multilingual websites, in addition to providing an apparent language switcher on the page, it is also crucial to clearly indicate the different language versions of your website to search engines. This can be done by including in the HTML's<head>Area additionhreflangthe tag.hreflangTags can tell search engines that a specific page is a version of the content in another language, helping to avoid duplicate content issues and ensuring that users are directed to the page most suitable for their language and region.

Using AnQiCMS'slanguagestags, you can dynamically generate these very convenientlyhreflanglinks. Here is how to use them:

<head>
    <!-- 其他meta标签和link标签 -->
    {%- languages websites %}
    {%- for item in websites %}
        <link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
    {%- endfor %}
    {%- endLanguages %}
</head>

This code will traverse all language sites and generate one for each<link rel="alternate">wherehrefURL pointing to the language version,hreflangThe attribute is set to the corresponding language code (such as "en-US", "zh-CN"), accurately informing the search engine of the language and regional location of each page.

Multilingual content publishing and management strategy

As mentioned earlier, AnQiCMS will not automatically translate your website content.This means that if you want the website to provide multiple language versions, you need to manually create and maintain the corresponding content for each language.This "human translation and maintenance" model just ensures the quality and localization of the content, avoiding the rigidity and inaccuracy that machine translation may bring.

In practice, you can use AnQiCMS's 'Content Model' and 'Category Management' features to establish an independent content system for each language site, including articles, products, single pages, and more.For example, create a "News CenterBy this structured management method, even with a large amount of content, it can maintain clear organization and efficient updates.

Summary

The multilingual support feature of AnQiCMS provides a solid foundation for websites committed to global operations. Through its flexible multi-site management capabilities, convenient language switch tags, and international SEO (such ashreflangThe excellent support allows operators to effectively build and maintain multilingual websites for global users.Although content translation and localization require manual input, the toolchain provided by AnQiCMS undoubtedly simplifies the complexity of technical implementation, allowing operators to focus more on providing high-quality, user-friendly content, thereby gaining a competitive advantage in the international market.


Frequently Asked Questions (FAQ)

  1. Does AnQiCMS provide an automatic translation feature?No, AnQiCMS does not provide built-in automatic translation functionality.The specific content of articles, product descriptions, and other specific content on the website must be manually created and maintained by operators according to different language versions.The system mainly provides a framework for managing and displaying multilingual content.

  2. How to configure different domain names for each language?You can create a separate site for each language using the "Multi-site Management" feature of AnQiCMS. When creating a site, you can bind different domain names to each language site (such asexample.comUsed for Chinese,en.example.comUsed in English), and configure your web server (such as Nginx or Apache) to direct the corresponding domain traffic to the corresponding site entry of AnQiCMS.

  3. What are some considerations for multilingual SEO on AnQiCMS besides the language switcher and Hreflang tags?In addition to the above two points, you should also ensure that an independent Sitemap is created for each language version of the website and in tools such as Google Search Console