In the AnQi CMS ecosystem, multilingual support and multi-site management are its core strengths, aimed at helping enterprises and content operators easily expand into global markets.When you build a multilingual website and want to provide a language switching feature on the front-end, you will naturally think: "Will the AnQiCMS multilingual website list include information about the website being visited?"The answer is affirmative, and this design has brought great convenience and rationality in practical application.
Understand the multilingual site list mechanism of AnQiCMS
AnQiCMS handles multilingual site lists in a very intuitive and easy-to-use manner. It provides a special template tag —languagesUsed to dynamically retrieve all configured multilingual site information in your website template.This label was originally designed to facilitate website visitors in switching between different language versions.
In particular, when you use{% languages websites %}...{% endLanguages %}such a template structure when calling the multilingual site list, AnQiCMS will return an array object containing all the multilingual sites that have been set (here we name it)websites)It is worth noting that thislanguagesThe tag does not accept any parameters.This means that, regardless of which language version of the site the current user is visiting, it will list all available multilingual sites without distinction, which naturally includes the site the user is currently browsing itself.
What information is included in the multilingual list item?
Each inwebsitesarray item (we usually refer to it in the)forloop as the}itemAll carry rich metadata, sufficient to build a fully functional language switcher. This information includes:
- Site language name (
LanguageName)For example, "Chinese", "English". - Language codes (
Language): Standard ISO language codes, such aszh-CN/en-US, which is crucial for generatinghreflangtags, helping with SEO. - Language emoticon (
LanguageEmoji): such as 🇺🇸, 🇨🇳, can add visual fun to the language switch button. - Language icon (
LanguageIcon)If a custom language icon is configured, the link will be provided here. - Site Name (
Name): The specific name of the language site. - Link Address (
Link)The most important information one, it provides the complete URL to jump to the language site. - Note (
Remark)andIs Nofollow (Nofollow)These provide some additional information and SEO control options.
The aggregation of these fields allows you to flexibly display language switching options on the front-end, whether it be text links, buttons with icons, or a combination of both.hreflangOptimize tags for search engines, and it can be easily achieved.
Why is the current site information included in the list?
The reason why AnQiCMS includes the self-information of the current visited site in the multilingual list is mainly based on the following considerations:
- The integrity of user experience:The purpose of language switching is to allow users to see all available language options.If the current language version is not listed here, it may confuse the user, making it difficult for them to intuitively know which language version they are in and to choose to reload the current language page.
- Simplicity of code implementation:
languagesThe design of tags without parameters simplifies the logic for template developers.It uniformly returns all data, developers do not need to write additional judgment logic to exclude the current site, just display or add special styles as needed in the template. - [en] SEO Optimization:AnQiCMS supports generating multi-language lists
hreflangTags. In HTML's<head>Segmenting these tags helps clearly inform search engines of the corresponding relationship between pages in different languages, which is crucial for the SEO performance of internationalized websites.hreflangThe specification of tags requires to include the current page itselfhreflangTherefore, including the current site in the list is in accordance with this standard.
In short, the design of AnQiCMS is well-considered. It provides rich information while also considering the simplicity of development, the smoothness of user experience, and the SEO requirements of international websites.
The difference from obtaining the current site information
It is worth mentioning that,languagesThe tag provides a list of "All multilingual sites". If you just want to obtain theitselfSystem information (such as website name, Logo, base URL, etc.), AnQiCMS provides another namedsystemtag. Through{% system with name="SiteName" %}This method allows you to directly access the specific attributes of the current site without having to traverse the entire multilingual site list.These two tags perform different functions, collectively forming the powerful and flexible content management system of AnQiCMS.
Common Questions (FAQ)
Ask: What is the label for the multi-language site list of AnQiCMS?
languagesCan it filter out the current site and only display other language options? Answer:languagesThe tag itself does not provide parameters to directly filter the current site.It will return all the configured multilingual site information, including the current visited site.ifConditional judgment, based onitem.LinkCompare with the current page URL to manually implement.Question: How to ensure that the page URL can correctly jump to the corresponding language version of the current page content when switching languages? Answer:
languagesEach site item returned by the tag includes oneLinkfield (item.LinkThis is the base URL for the site in the language version.AnQiCMS will automatically generate the correct redirect link based on your multilingual configuration and the current page path./article/1After switching to the English site, it usually also tries to jump to/en/article/1or a similar structure, ensuring that users remain in the same content context after switching languages. Additionally,hreflangTag usage also helps search engines understand the correlation between content in different language versions.Q:
languagesDoes the label obtain a list of sites, including those ordinary sites without multilingual functionality? Answer:languagesTags are designed to retrieve the list of "Multilingual Sites".According to the document description of AnQiCMS, it will return all site information configured with multilingual properties.This means that ordinary sites that run as standalone sites but are not explicitly configured as part of the multilingual feature are usually not included in this list.