How does AnQiCMS support the switching of multilingual content on the page?

In today's global digital world, website multilingual support has become a key step for enterprises and content operators to expand into international markets and serve diverse user groups.AnQiCMS as an efficient enterprise-level content management system has fully considered this requirement and provided a flexible and practical multi-language content switching display solution.

The multilingual strategy of AnQiCMS lies in its powerful multi-site management function and the flexible calling mechanism of the front-end template.It does not simply provide automatic content translation, but encourages providing carefully planned and independently maintained localized content for users of different languages.This ensures the accuracy and authenticity of the content, and can better adapt to the user habits and search engine optimization (SEO) strategies of each region.

How to implement multilingual content management in AnQiCMS?

The main way AnQiCMS implements multi-language content display switching is by using its 'Multi-site Management' feature.This means, you can create a separate website for each target language.For example, your main site is in Chinese, you can create an English site, a Japanese site, etc.Each site has its own domain (or subdomain/subdirectory), an independent database (optional, or it can be reused), and an independent content library.

  1. Create a multilingual site:In the AnQiCMS backend, through the 'Multi-site Management' feature, you can easily add new sites. During the process of adding a new site, you need to specify a unique domain name for the new site (for example, the Chinese siteexample.com, English siteen.example.comorexample.com/en), and configure the corresponding site root directory and database information. In this way, each language site can independently publish and manage its specific language content.
  2. Content is maintained independently:In each language site, you can publish articles, products, pages, and more, just like managing a regular site.Ensure that all content is written in the corresponding language on the language site.For example, publish purely English articles on English sites, and purely Japanese articles on Japanese sites.This independent maintenance approach can ensure the quality and localization of the content.
  3. Language package support (system level):Although multilingual content needs independent maintenance, AnQiCMS provides support for the 'default language package' at the system level.This means, you can set the display language of the background interface and some built-in prompts (such as button text, system messages, etc.) to facilitate operations for administrators in different language regions.This will not affect the content you actually publish.

How to implement multi-language switching display on the page?

Implement the multilingual switch on the page, mainly depending on the provided in the AnQiCMS front-end templatelanguagestags, as well as reasonablehreflangtag configuration.

  1. UtilizelanguagesTag to get the list of language sites:AnQiCMS provided{% languages websites %}The tag can dynamically retrieve all the multilingual site information you have configured on the backend.It will return a list containing details of each language site, including language names (such as "Chinese", "English"), language codes (such as "zh-CN", "en-US"), and links to the language sites.

    You can use this tag in the public part of the website template (such as the header navigation bar or footer) to build a language switcher. The code structure is roughly as follows:

    {%- languages websites %}
    {%- if websites %}
    <div class="language-switcher">
        <span>切换语言:</span>
        {%- for item in websites %}
        <a href="{{item.Link}}">
            {%- if item.LanguageIcon %} {# 如果配置了语言图标则显示图标 #}
            <img src="{{item.LanguageIcon}}" alt="{{item.LanguageName}}" />
            {%- else %} {# 否则显示语言Emoji表情或名称 #}
            {{item.LanguageEmoji}}
            {% endif %}
            {{item.LanguageName}}
        </a>
        {%- endfor %}
    </div>
    {%- endif %}
    {%- endlanguages %}
    

    This code will iterate over all configured language sites and generate a toggle button with the language name and link for each site.When the user clicks on a language button, the page will jump to the corresponding language website.

  2. ConfigurationhreflangLabel for SEO optimization:To help search engines better understand your multilingual content and display it to the correct users, configurehreflangtags are crucial.hreflangThe tag tells search engines that your page has other language or regional versions.

    You can use the template's<head>section, usinglanguagestag to dynamically generatehreflang:

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

    This code will generate a label for each language sitelinkwherehrefattribute to point to the URL of the language site,hreflangThe attribute contains the corresponding language code (for exampleen-USorzh-CN). This is very beneficial for improving the performance of multilingual websites in international search engines.

By following these steps, AnQiCMS can provide a clear and efficient multilingual content management and switching solution, allowing your website to easily reach global users.


Frequently Asked Questions (FAQ)

  1. Does AnQiCMS support automatic translation of content or do different language versions need to be manually created?AnQiCMS does not provide automatic translation functionality; it adopts the strategy of 'one language, one site'.This means you need to create a site for each target language independently, and manually publish and maintain the corresponding content on each site.The benefit of doing so is that it ensures the quality and localization of the content, avoiding the inaccuracies and unnaturalness that may be caused by machine translation.

  2. Do I need to create a new website template for each language version?Not necessarily. AnQiCMS's template system is very flexible.You can choose to reuse the same website template for all language sites, just make sure that the content of the template calls the tags (such as article titles, descriptions, etc.) to display the corresponding language content correctly.At the same time, AnQiCMS also supports customizing different templates for language sites to meet the design needs of specific markets or cultural backgrounds.

  3. How can multilingual content be optimized for search engines (SEO)?First, by placing on the page<head>addhreflangTags (as shown in the article), inform search engines that your page has different language or regional versions.Secondly, ensure that each language site has high-quality, original content that is relevant to the target audience.Use a separate domain, subdomain, or subdirectory to distinguish different language sites, and conduct keyword research and optimization for different languages, which also helps to improve the SEO effect of multilingual websites.