In AnQiCMS multilingual site, how to implement language switching and adaptation for the navigation menu?

Calendar 👁️ 86

Building a global website on AnQiCMS, allowing content to be presented in multiple languages to users worldwide, has become the only way for many enterprises to expand into the international market.Navigation menus serve as the first threshold for user interaction with a website, and their smooth switching and precise adaptation in multilingual environments are undoubtedly the key to improving user experience and optimizing SEO performance.Today, let's delve into how to cleverly implement the language switching and adaptation of navigation menus in the AnQiCMS multilingual site.

The foundation of AnQiCMS for multilingual: Tailor-made for global users

AnQiCMS is a system that deeply understands the needs of enterprise-level content management, and its 'multilingual support' function is one of the core advantages for building an internationalized website.It is not just a simple translation of content, but also about providing a mechanism that allows the structure, URL, and even navigation of a website to seamlessly adapt to the habits of users in different languages.

In the AnQiCMS backend settings, we can easily configure the "default language package", which lays the foundation for the entire website's language base.It is also worth mentioning that AnQiCMS's powerful "multi-site management" feature also provides flexible deployment options for multilingual sites.We can manage each language as an independent site, for example, deploying the English site onen.yourdomain.comDeployed on the Chinese sitecn.yourdomain.comIn this mode, each language site can have its own domain, content, and even customized templates, thus achieving more refined operation and management.This architecture naturally supports the independent configuration and management of navigation menus, allowing each language's navigation to be fully independent and adapted to its content system.

Flexible construction of multilingual navigation menus:navListIntelligent application of

AnQiCMS provides a powerful template tag system, wherenavListLabels are the tools to build navigation menus. To achieve accurate adaptation of navigation menus in multilingual sites, you first need to make detailed configurations in the AnQiCMS backend.

Generally, under the "Background Settings" and in the "Navigation Settings" area, we manage navigation links based on different navigation categories (such as top main navigation, footer navigation, etc.).In a multilingual, multi-site AnQiCMS environment, this means that each language site will have its own independent navigation settings.For example, on the English site backend, we will configure the corresponding English menu items and links for "Main Navigation";In the background of the Chinese site, the Chinese menu items and links are configured for the main navigation.

In the template file, we usenavListtags to dynamically render these menus. For example:

{% navList navs with typeId=1 %} {# typeId=1 通常代表主导航 #}
<ul>
    {%- for item in navs %}
        <li class="{% if item.IsCurrent %}active{% endif %}">
            <a href="{{ item.Link }}">{{item.Title}}</a>
            {%- if item.NavList %} {# 如果有子菜单 #}
            <dl>
                {%- for inner in item.NavList %}
                    <dd class="{% if inner.IsCurrent %}active{% endif %}">
                        <a href="{{ inner.Link }}">{{inner.Title}}</a>
                    </dd>
                {% endfor %}
            </dl>
            {% endif %}
        </li>
    {% endfor %}
</ul>
{% endnavList %}

ThisnavListThe label will automatically read and display the navigation menu configured under the current site context (i.e., the language site being accessed).item.TitleWill display the navigation name corresponding to the language configured in the background, anditem.LinkThis will point to the correct language version of the page link. This mechanism ensures that whether it is an English site or a Chinese site, the main navigation will display content in the respective language and link correctly to the corresponding page.

Implement a language switcher:languagesA seamless bridge for tags

It is not enough to have navigation in each language, users also need a intuitive and convenient switcher to freely switch between different language versions. AnQiCMS provides this for users.languagesThe label acts as a seamless bridge between different language sites.

languagesThe tag can retrieve all the multi-language site information configured under the current AnQiCMS instance, including their language names, language codes, and even the Emoji or icon links used to beautify the interface.This allows us to very conveniently build a language switch dropdown menu or icon list in the template.

We usually place the language switcher in a prominent position on the page, such as the upper right corner of the header or the footer. Here is an example of a typical language switcher implementation:

{%- languages websites %}
{%- if websites %}
<div class="language-switcher">
    <span>切换语言:</span>
    {%- for item in websites %}
    <a href="{{item.Link}}" {% if item.Language == system.Language %}class="current-lang"{% endif %}>
        {%- if item.LanguageIcon %} {# 如果有自定义语言图标 #}
        <img src="{{item.LanguageIcon}}" alt="{{item.LanguageName}}"/>
        {%- else %} {# 否则使用Emoji #}
        {{item.LanguageEmoji}}
        {% endif %}
        {{item.LanguageName}}
    </a>
    {%- endfor %}
</div>
{%- endif %}
{%- endLanguages %}

In this example,websitesThe variable contains data from all language sites. We traversewebsitesto create a link for each language site.item.LinkThe field is particularly important, as it directly points to the link corresponding to the current language version, ensuring that users can immediately jump to the translation page of the same content after switching languages, rather than returning to the homepage.system.LanguageIt can be used to determine the currently active language, making it convenient to add special styles to the current language.

To further optimize the SEO performance of multilingual websites, AnQiCMS also supports throughlanguagestag generationhreflangProperty.hreflangThe tag can tell search engines that your website has multiple language versions, and these versions are interlinked, thus avoiding duplicate content issues and guiding search engines to display the correct language version of the page. We usually place it on the page.<head>Area:

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

In this way, we not only provide users with a convenient language switching function, but also provide clear guidance for search engines, greatly enhancing the internationalization competitiveness of the website.

The fusion and practice in the template: creating a smooth user experience

Effectively integrating multilingual navigation menus and language switchers in the template is crucial for ensuring a smooth user experience.

Imagine, the user visits your English site, the navigation menu clearly displays options such as 'Home', 'Products', 'About Us', and so on.When the user clicks the 'Chinese' switch at the top right corner of the page, the page will immediately jump to the corresponding Chinese site, at this time the navigation menu will also automatically change to 'Home', 'Products', 'About Us', etc. in Chinese, and the content will also change to Chinese.The process was natural and smooth, with no abruptness.

In actual operation, we need to ensure:

  • Uniform template structure:Although the content and language are different, the basic template structure of each language site should be consistent, which can ensure the stability of page layout when switching languages, and reduce the cost of users learning.

Related articles

How to use AnQiCMS navigation list tags in conjunction with the `include` tag to optimize the common navigation part of the template?

## How to effectively use AnQi CMS navigation list with `include` tag, creating a high-efficiency and maintainable public navigation In website operation, the navigation bar, as the first point of contact between users and website content, is of great importance.A clear, easy-to-maintain, and efficient navigation system that can significantly improve user experience and lay a solid foundation for the long-term development of the website.As an experienced website operations expert, I know that how to elegantly handle the public navigation module in a content management system is a key link in template development. Today

2025-11-07

What is the cause and solution for the front-end page not updating after modifying the AnQiCMS backend navigation settings?

Hello, all the operation experts and webmasters of AnQi CMS!I am very happy to discuss with everyone a common but perplexing problem that may be encountered during the use of AnQiCMS: why, despite my modifications to the navigation settings in the background, the front-end page does not update in a timely manner?As an experienced website operations expert, I know how frustrating this 'what you see is not what you get' experience can be.Don't worry, this is not a Bug of AnQiCMS, but some mechanisms behind the content management system that operate when pursuing high performance and flexibility.Today, let's delve deep into this issue

2025-11-07

What is the SEO optimization practice of AnQiCMS navigation menu, for example, adding the `nofollow` attribute?

## Mastering AnQiCMS Navigation Menu SEO Optimization: `nofollow` Strategy and Practical Guide As an experienced website operations expert, I fully understand the importance of the navigation menu for a website.It is not only the guide for users to explore the content of the website, but also the key path for search engines to understand the structure of the website and evaluate the value of the page.AnQiCMS is an enterprise-level content management system developed based on the Go programming language, which has always considered SEO friendliness as a core consideration and provides operators with rich and flexible tools to optimize all aspects of the website

2025-11-07

Does AnQiCMS support adjusting the level and order of the navigation menu through drag and drop?

In the daily operation of website management, the adjustment frequency of the navigation menu may be higher than we imagine.In order to adapt to business development, optimize user experience, or adjust SEO strategies, it is a common demand of operators to manage the navigation structure flexibly and efficiently.Among them, adjusting the hierarchy and order of the menu through an intuitive drag-and-drop method is a feature highly favored in modern content management systems (CMS).Then, for the AnQiCMS (AnQiCMS) that we are deeply familiar with, does its backend support such drag-and-drop operations?

2025-11-07

How to display the subtitle or description information of a navigation item in the AnQiCMS navigation menu?

As an experienced website operations expert, I fully understand the importance of a powerful and flexible content management system (CMS) for website operations efficiency and user experience.AnQiCMS (AnQi CMS) is exactly such an excellent tool, which with its efficient and customizable features, helps us easily manage all aspects of website content.Today, let's delve into a common but highly valuable operation issue in website navigation design: how to display the subtitle or description information of navigation items in the AnQiCMS navigation menu?Navigation menu as the skeleton of the website

2025-11-07

How do `BaseUrl` and `MobileUrl` in the AnQiCMS global feature settings affect navigation links?

How do `BaseUrl` and `MobileUrl` in the AnQi CMS global feature settings affect navigation links?The foundation and mobile strategy of website operation As an experienced website operations expert, we understand that the basic configuration of a website, especially the settings related to URL, is of great importance for the healthy operation of the website, user experience, and even search engine optimization (SEO).In such a rich-featured system as AnQiCMS

2025-11-07

What will happen to the navigation display when the category or page pointed to by the AnQiCMS navigation link is deleted?

As an experienced website operations expert, I am well aware that managing the lifecycle changes of website content is a challenge that should not be overlooked, especially when these contents are closely connected with the core navigation of the website.AnQiCMS (AnQiCMS) is an efficient and customizable enterprise-level content management system that has taken these operational needs into account from the very beginning and provides us with powerful tools to deal with such issues.Today, let's delve into a common scenario: "When the AnQiCMS navigation link points to a category or page that has been deleted"}

2025-11-07

Does AnQiCMS navigation menu support displaying different menu items based on user login status or permissions?

## The Wisdom of AnQiCMS Navigation Menu: How to Customize Exclusive Experience Based on User Status or Permissions Providing personalized browsing experiences for different user groups has become a key factor in improving user satisfaction and conversion rates in modern website operations.Imagine that your website can intelligently identify visitors: unregistered users see registration and login options, while logged-in VIP members are directly shown exclusive benefits and customized services.This refined content presentation will undoubtedly greatly enhance user stickiness and website efficiency.Then, for high efficiency

2025-11-07