Today, with the deepening of globalization, it is a key step to expand the market and enhance brand influence to enable your website to support multiple languages and reach users in different countries.AnQiCMS (English version: AnQiCMS) was designed with this requirement in mind, providing users with a highly efficient and flexible multilingual content switching solution.
The core of AnQiCMS achieving multi-language content switching lies in its powerfulMulti-site managementfunction, supplemented byDefault language packageconfiguration, as well as the front-endTemplate tagsThe flexible application. It effectively distinguishes the language display at the system level from the language management of actual content (articles, products, etc.), ensuring the independence and convenience of content management.
Understand AnQiCMS's multilingual architecture
AnQiCMS in multilingual support mainly adopts the strategy of "site isolation, unified management".This means that if your website needs to provide completely different content for different languages, or needs to have independent domain names and SEO strategies for each language version, then creating multiple language sites is a recommended and efficient way by AnQiCMS.Each site can be considered a separate language version, with its own content, categories, and templates.
Configure multilingual sites: content isolation and unified management
To implement true multi-language content switching, you need to fully utilize the multi-site management function of AnQiCMS.This is like setting up branches for your brand in different regions of the world, with each branch responsible for content operations in a language market.
- Add a new site:In AnQiCMS backend, find the 'Multi-site Management' feature, click 'Add New Site'. Here, you will create a separate site for each language version.
- Key information setup:
- Website address:This is the most important part of your multilingual strategy. You can set independent subdomains for different language sites (such as
en.yourdomain.com代表English site),或者通过子目录区分(如yourdomain.com/en代表English site)。确保每个语言版本都有一个清晰且独特的访问地址。 - 站点根目录与数据库名称:To ensure the independent storage and management of content in different language versions, you need to specify a unique 'site root directory' and 'database name' for each language site.AnQiCMS will store the cache, uploaded files, and other files in the specified directory, and store all the content data of the site in the specified database.This isolation design greatly reduces the complexity of multilingual content management and avoids data confusion.
- Select the template you want to use:AnQiCMS Allows you to select different templates for each language site.This means that you can design or use different interface layouts and styles for different language versions based on the cultural habits and aesthetic preferences of the target users.For example, the English site can use a minimalist modern style, while the Japanese site may prefer delicate and detailed.
- Administrator account password:Set independent administrator accounts and passwords for each language site, which can facilitate content management for different teams or individuals, and achieve separation of rights and responsibilities.
- Website address:This is the most important part of your multilingual strategy. You can set independent subdomains for different language sites (such as
Implement front-end multi-language switching: guide users to the correct content
When you have configured multiple language sites in the background, the next step is to provide a convenient language switch on the website front-end and guide search engines to correctly identify the content of these different language versions. AnQiCMS provideslanguagesThe template tag is used to achieve this goal.
UselanguagesCreate a language switcher tag
languagesThe tag can retrieve all configured multilingual site information and display it as a switch link on the front end.
For example, you can add a language switcher at the header or footer of the website, the code 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 %}
{{item.LanguageEmoji}}
{% endif %}
{{item.LanguageName}}
</a>
{%- endfor %}
</div>
{%- endif %}
{%- endLanguages %}
In this code,websitesThe variable includes detailed information for each language site,item.LinkThis is the access address for this language version,item.LanguageNameThis is the language name,item.LanguageEmojianditem.LanguageIconThen it provides a variety of language identification options. By looping through this information, you can easily build a beautiful and practical language switch menu.
Optimize SEO: Usage of Hreflang Tags
To avoid search engines treating content in different languages as duplicate and to ensure users are directed to the version that best suits their language, usehreflangThe label is crucial. AnQiCMS provideslanguagesconvenience for labeling as well. You can add labels in the HTML block of the<head>blockhreflangto guide search engines:
{%- languages websites %}
{%- for item in websites %}
<link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
{%- endfor %}
{%- endLanguages %}
This code will generate alink rel="alternate"tag for each language site,hrefPointing to the URL of this language version,hreflangthen specifies the language code of this page (such asenrepresenting English,zh-CNRepresenting Simplified Chinese). This effectively helps search engines understand the structure of your multilingual content, thereby improving the search visibility of each language version.
Content creation and optimization: Ensure multilingual content quality
Once the multilingual site architecture is set up and the front-end switch entry is configured, the next focus is on the content itself.Each language site needs to fill in high-quality, native language content.
- Independent TDK settings:For each language