How to display multilingual content and switch on the AnQiCMS website?

Today, with the increasing popularity of globalization, many companies hope that their websites can serve users from different language backgrounds.AnQiCMS (AnQiCMS) understands the importance of this requirement and has integrated powerful multilingual support capabilities from the beginning of the system design, making it easy for you to build and manage multilingual websites.

Display multilingual content on your AnQiCMS website and allow users to switch between them, which mainly revolves around its "multi-site management" core function.Aqie CMS treats each language as an independent site for management, but these sites can be unified in the same background, greatly simplifying the maintenance of multilingual websites.

Understanding the multilingual mechanism of AnQiCMS

Firstly, we need to clarify the basic approach of the Anqi CMS for handling multilingual content.Different from some CMS that add multiple language versions under a single content item, Anqi CMS adopts the strategy of 'site is language'.This means that if you plan to have two language versions of the website, Chinese and English, you will create two independent sites in the Anqicms backend: one for Chinese content and one for English content.

This design brings several obvious advantages:

  • Strong content independence:Each language's content is completely independent, making it convenient for targeted content planning, SEO optimization, and localization operations, thus avoiding mutual interference between different language content.
  • Flexible customization:You can choose different templates for different language sites, and even customize unique features or layouts to meet the specific needs of a particular language site.
  • High management efficiency:Even though the content is independent, these sites are all managed under a single Anqing CMS backend, making it convenient for you to publish content in multiple languages, manage users, and analyze data.

It is worth mentioning that the default language package setting of the AnQiCMS backend (located in the Global Function Settings), is mainly used to switch the display language of the backend management interface, as well as the language of some built-in system prompts.It will not automatically translate the specific content of your website, such as articles, products, or categories.This content needs to be created and maintained separately on your language sites.

Back-end settings: Create independent sites for different languages

Building a multilingual website, start with the 'Multi-site Management' feature from the Anqi CMS back-end.

  1. Log in to the backend and enter the multi-site management:Visit your AnQi CMS backend, find the 'Multi-site Management' option in the left navigation menu.
  2. Add a new site:Click the "Add new site" button. Here, you will configure the basic information for your new language version website.
    • Site Name:Create a recognizable name for the new site, such as "English Site" or "Chinese Site".
    • Site root directory:Specify a separate folder path to store the cache and other data for the language site. It is usually recommended to name it with the domain name plus language identifier, for example/app/en_yourdomain_comor/app/cn_yourdomain_com.
    • Website address:This is the key to the new language website. You need to assign a separate domain name or subdomain to each language site, for exampleen.yourdomain.com(English site) andcn.yourdomain.com(Chinese site), or use the directory formatyourdomain.com/enandyourdomain.com/cnEnsure that these domain names are correctly resolved to your server and configured with the appropriate reverse proxy (if you are using Apache or Nginx).
    • Admin account password:Set up an independent backend management account and password for this new site.
    • Database name:Similarly, allocate an independent database for the new site, for exampleen_yourdomain_com. If you are installing AnQi CMS via Docker, you can usually choose to 'Reuse default database account information', and the system will automatically create the database.
    • Select the template to use:You can choose an existing template or customize a dedicated template for a new language site.
  3. Repeat the steps to create all language sites:Follow these steps to create a separate site for all your target languages.

After completing these settings, each language version has its own separate access address and management entry.

Content management: fill exclusive content for each language

Once the language site is set up, the next task is to fill them with content.You need to log in to the backend of each language site separately, and publish and manage content according to the habits of that language.

For example, when you log in to the English site's backend, all functions such as 'Document Management', 'Document Classification', 'Single Page', and so on will be used to create and edit English content.Similarly, in the background of Chinese sites, you will focus on the publication of Chinese content.This means that the article title, content, category name, tags, and single page content all need to be translated into different languages and entered separately.

This method ensures the professionalism and accuracy of the content, avoiding the stiffness and unnaturalness that may be brought by machine translation.

Front-end implementation: Multi-language switching and SEO optimization

Implementing language switching on the frontend page is crucial for allowing users to choose their preferred language.The AnQi CMS provides convenient template tags to help you achieve this, combining SEO**practices to ensure that your multilingual website can be correctly understood and indexed by search engines.

1. Create a multi-language switcher:

You can place a language switcher in the header, footer, or sidebar of the website. Anqicms provides alanguagestag that can retrieve information about all configured multilingual sites.

In your template file (for examplebase.htmlor in the public header file) you can use the following code to display language switch options:

{%- 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 %}
        {{item.LanguageEmoji}}
        {% endif %}
        {{item.LanguageName}}
    </a>
    {%- endfor %}
</div>
{%- endif %}
{%- endLanguages %}

This code will iterate through all configured language sites and generate a link for each language.item.Linkpoint to the home page of the language site,item.LanguageNameDisplay language name (such as "Chinese", "English"), you can also choose to displayLanguageIcon(Flag icon) orLanguageEmoji(Emoticon). After clicking the link, the user will be redirected to the website in the corresponding language.

2. Implement Hreflang tags to optimize search engine visibility:

The hreflang tag is crucial for SEO of multilingual websites.It tells the search engine that your website has multiple language versions, specifies the URL for each language version, thus avoiding duplicate content issues, and ensures that the search engine displays the correct language content to users of the corresponding language.

You need to add the corresponding HTML in each language site<head>parthreflangtags. Similarly, we can uselanguagestags to dynamically generate these links.

Before yourbase.htmlthe file<head>Add the following code within the tag:

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

here,item.LinkIt is the complete URL for each language site,item.LanguageIt is the language code of the language site (for example, "zh-CN", "en-US"). This way, search engines can accurately identify the structure of your multilingual content.

Summary

By using the powerful "Multi-site Management" function and flexible template tags of AnQi CMS, you can systematically build and operate multilingual websites.Create an independent language site from the backend, implement an intuitive language switch on the frontend, and combine with Hreflang tags for SEO optimization, the entire process is efficient and controllable.This not only helps you expand your global market, but also provides a better and more personalized browsing experience for users from different cultural backgrounds.


Frequently Asked Questions (FAQ)

Q1: Is the multilingual content of AnQi CMS automatically translated?A1: No. Anq CMS adopts the 'site is language' strategy, you need to create an independent site for each language and manually publish and manage the corresponding language content on each site.The system will not provide automatic translation functionality, as this is done to ensure the quality of translation and the localization accuracy of the content.

Q2: Do I need to install a separate AnQi CMS program for each language site?A2: Not required. The multi-site feature of AnQi CMS allows you to create and manage multiple independent language sites under a single program installation.You only need to install once AnQi CMS, and then you can add sites in different languages through the "Multi-site Management" feature in the background.

Q3: Is the multilingual function of AnQi CMS SEO-friendly?A3: Yes, the multilingual design of Anqi CMS is very friendly to SEO. It allows each language site to have an independent domain or URL structure, independent content and metadata (TDK), and through the front end,languagesLabel easily generatedhreflangAttributes, help search engines accurately understand and index your different languages