In today's increasingly globalized world, providing multilingual support for websites has become a basic requirement for expanding the market and serving users in different regions.AnQiCMS (AnQiCMS) is well aware of this need, built-in powerful multilingual functions, allowing website administrators to easily achieve content internationalization.This article will discuss in detail how to effectively display the language switch options of the AnQiCMS site and set it up correctlyhreflangTag, to optimize the internationalization identification of search engines.
Understand AnQiCMS multilingual capabilities
AnQiCMS is an efficient and customizable content management system, its project advantages are clearly pointed out to support the switching and display of multilingual content, aiming to help enterprises expand into the international market.This means that the system not only provides the infrastructure for content management, but also simplifies the deployment and maintenance of multilingual sites.In the AnQi CMS backend, we can create different language versions of sites through the "Multi-site Management" feature, and adjust the "Default Language Pack" in the "Global Settings" to provide localized browsing experiences for users of different sites.
Display the language switch option for multi-language sites.
To facilitate users switching between different language versions, it is usually set up a language switcher in a prominent position on the website (such as the navigation bar, footer). In AnQiCMS, this can be done throughlanguagesThe template tag can be easily implemented.
languagesThe tag can retrieve the list of all configured multilingual sites. It does not require any parameters, it is used directly.{% languages websites %}You can get an array containing information about all language sites. Then, we can iterate through the array to generate a link for each language site.
Information about each language site (item) includes many useful fields, such as:
LanguageName: The display name of the language (such as "Simplified Chinese", "English").LanguageLanguage code (such as "zh-CN", "en"), this ishreflangthe key tag.LanguageEmoji: Represents the language emoji (such as 🇺🇸, 🇨🇳).LanguageIconIf configured, it can display the icon corresponding to the language.LinkThe URL address of the language site, used for users to click and switch.
Here is an example of a language switcher implemented in the template:
{%- languages websites %}
{%- if websites %}
<div class="language-switcher">
<span>切换语言:</span>
{%- for item in websites %}
<a href="{{item.Link}}" class="language-option">
{%- if item.LanguageIcon %}
<img src="{{item.LanguageIcon}}" alt="{{item.LanguageName}} Flag" class="language-flag" />
{%- else %}
<span class="language-emoji">{{item.LanguageEmoji}}</span>
{% endif %}
<span class="language-name">{{item.LanguageName}}</span>
</a>
{%- endfor %}
</div>
{%- endif %}
{%- endLanguages %}
This code will traverse all configured language sites and create a link for each site.If the site is configured with an icon, the icon will be displayed; otherwise, the language's emoji will be displayed.Click the link and the user can easily navigate to the corresponding language version of the page.
ImplementationhreflangLabel for optimizing SEO
hreflangTags are crucial for the search engine optimization of multilingual and multiregional websites.It can tell search engines which pages are alternative versions of the same content, and specify the target language and geographic region of these versions.This helps search engines provide users with the most relevant language or region pages, while avoiding penalties for duplicate content.
Combined with AnQiCMS,languagestags, we can also generate them conveniently.hreflangTags. These tags are usually placed in the HTML document.<head>Within the area.
The following is on the page<head>Partially addhreflangLabel example:
<head>
{# 其他head内容... #}
{%- languages websites %}
{%- for item in websites %}
<link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}" />
{%- endfor %}
{%- endLanguages %}
</head>
This code will generate corresponding language versions for all configured languages on the current page.hreflanglinks.item.LinkIt ensured that the link points to the correct language page, anditem.Languagethen provided the standard language codes such asenrepresents English,zh-CNRepresents Simplified Chinese. Properly setting these tags will greatly improve the performance of the website in international search engines.
Considerations in practice
In practical operation, there are several aspects that deserve attention. First, make sure that each language site and its corresponding domain or subdirectory/subdomain is correctly set in the "Multi-site Management" section of the AnQiCMS background.Secondly, in the "Global Settings" option of the "Default Language Pack", specify an appropriate language for each site. This usually determines the backend interface language of the site and some system default prompts.It is most important that, although AnQiCMS provides a switching mechanism, the content translation work for each language site still needs to be done manually to ensure that users receive high-quality, accurate localized information.
By using the above method, you can effectively set up and manage multilingual websites in AnQiCMS, not only enhancing user experience, but also through precisehreflangSet to ensure that your internationalized content is correctly indexed and displayed by global search engines, thereby reaching a wider audience.
Frequently Asked Questions (FAQ)
Q1: How to configure different language version sites in the AnQiCMS backend?A: You can create new sites using the 'Multi-site Management' feature and specify independent domains or paths when creating or editing sites.Later, in the "Global Settings" of each site, you can select the site's "default language package", which will affect the internal language settings and the display of some default texts.Content in different languages (articles, products, etc.) should be published and managed under their respective sites.
Q2: SettingshreflangWhat are the specific benefits of tags for international SEO of the website?A:hreflangLabels have three main advantages:
- Avoid repetition content penaltyIt informs search engines that different URLs correspond to language or region-specific versions of the same content, rather than plagiarism or duplication, thus avoiding SEO negative impacts.
- Improve the ranking of localized content: Search engines can prioritize the display of the most relevant pages based on the user's language and location, thereby improving the search ranking of your localized content in the target market.
- Enhancing user experienceThe user can directly see the page that matches their language and regional preferences in the search results, reducing the trouble of manual switching, reducing the bounce rate, and improving the conversion rate.
Q3: How do I only display the language switch option on specific pages?A: The display of language switch options depends entirely on your template design. You just need to place the above language switcher code snippet in the specific template file where you want it to be displayed (such asheader.html/footer.htmlIn the or a specific page template, you can do this. If you only want to display the code on a few pages, you can add it only to these page template files; if you want to display it throughout the entire site, it is usually placed in the publicbase.htmlorheader.htmlTemplate in.