How to specify different navigation categories with the `typeId` parameter of AnQiCMS navigation tags?

Calendar 👁️ 73

As an experienced website operations expert, I am well aware that a flexible and efficient navigation system is crucial for the user experience and Search Engine Optimization (SEO) of a website. AnQiCMS excels in this aspect, especially through its powerful template tag system, particularlynavListLabel collaborationtypeIdParameters have provided great convenience for the customization of website navigation. Today, let's delve into this in more detail.typeIdThe mystery of parameters and how to cleverly use them to manage different types of navigation categories.

Website navigation: the cornerstone of architecture and the guide for users.

Website navigation, as the name implies, is the path that guides users to navigate through the website content.A well-designed navigation not only helps users find the information they need quickly, improve access efficiency, but also effectively communicates the structural hierarchy of the website to search engines, helping to capture and index content.AnQiCMS deeply understands this, it modularizes the navigation management, allowing operators to create and manage multiple independent navigation menus in the background according to actual needs, to adapt to different page areas or functional scenarios.

AnQiCMS's navigation category: a flexible and variable menu collection

In the AnQiCMS backend, through the "Navigation Settings" function under "Backend Settings", you can create and maintain multiple navigation categories.This is like preparing multiple menus for your website, each serving different dining scenarios.For example, you can have a 'main navigation' at the top of the website, a 'footer navigation' to display copyright information or secondary links, and even design a separate 'sidebar navigation' for specific topic pages or member centers.

Each navigation category has a uniqueIDThis ID is used internally to distinguish different navigation collections. By default, the system will have an ID of1The "default navigation". When you add a new navigation category, the system will assign a new ID to it, for example2/3These unique IDs are the key to accurately calling specific navigation through template tags.

navListwith the tag andtypeIdParameter: Precise navigation controller

AnQiCMS template system providesnavListThe tag is used to output the navigation link list on the front-end page. Its basic usage is:

{% navList navs %}
    {# 在这里循环输出导航链接 #}
{% endnavList %}

here,navsIs the variable name you define for the navigation list, you can use any name you like.

To letnavListLabels no longer just call the default navigation, but specify calling a particular navigation category,typeIdThe parameters come into play.typeIdParameters allow you to explicitly specifynavListThe label should be retrieved from which navigation category to get the link data. Its usage is very intuitive:

{% navList mainNav with typeId="1" %}
    {# 循环输出主导航链接 #}
{% endnavList %}

{% navList footerNav with typeId="2" %} {# 假设ID为2的导航类别是“页脚导航” #}
    {# 循环输出页脚导航链接 #}
{% endnavList %}

By adding innavListthe tag withwith typeId="N"(Where N is the ID of the navigation category you create in the background), you can easily display different navigation menus in different areas of the website as needed.

typeIdThe practical application scenario: Make website navigation smarter

applytypeIdParameters, you can implement a variety of flexible navigation management strategies:

  1. Multi-position navigation layout:

    • Top main navigation:{% navList mainNav with typeId="1" %}
    • Bottom footer navigation:{% navList footerNav with typeId="2" %}
    • sidebar topic navigation:{% navList sidebarNav with typeId="3" %}By creating independent navigation categories for different page areas, you can ensure that each area's navigation focuses on its specific guidance goal, avoiding redundant menu items and information overload.
  2. functional navigation separation:

    • Some websites may need to provide a separate navigation menu for 'Member Center' or 'Partner Entrance'. You can create a 'Member Navigation' category (for exampletypeId="4"), then call this navigation separately on the member center page without interfering with the main navigation structure of the website.
  3. Navigation distinction for multiple sites/multiple languages(combined)siteId): AlthoughtypeIdused to distinguishnavigation categoryBut the multi-site feature of AnQiCMS also means that each site can have its own navigation categories. If your AnQiCMS deployment has multiple sites and you need to retrieve navigation data from other sites, in addition totypeIdYou can also combinesiteIdSpecify the target site with parameters

How to write in the templatetypeIdThe navigation code called

Below is a combination oftypeIdand AnQiCMS navigation data structure template code example. The navigation list usually supports a two-level structure,item.NavListused to represent sub-navigation.

{# 假设我们有一个ID为1的主导航类别 #}
<header class="main-header">
    <nav>
        {% navList mainNav with typeId="1" %}
            <ul class="main-menu">
            {% for item in mainNav %}
                <li class="menu-item {% if item.IsCurrent %}active{% endif %}">
                    <a href="{{ item.Link }}">{{ item.Title }}</a>
                    {# 如果有子导航,则进行循环 #}
                    {% if item.NavList %}
                        <ul class="submenu">
                        {% for subItem in item.NavList %}
                            <li class="submenu-item {% if subItem.IsCurrent %}active{% endif %}">
                                <a href="{{ subItem.Link }}">{{ subItem.Title }}</a>
                            </li>
                        {% endfor %}
                        </ul>
                    {% endif %}
                </li>
            {% endfor %}
            </ul>
        {% endnavList %}
    </nav>
</header>

{# 假设我们有一个ID为2的页脚导航类别 #}
<footer class="main-footer">
    <nav>
        {% navList footerNav with typeId="2" %}
            <ul class="footer-links">
            {% for item in footerNav %}
                <li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
            {% endfor %}
            </ul>
        {% endnavList %}
    </nav>
</footer>

In this example, we clearly go throughtypeId="1"Navigated to the main navigation, throughtypeId="2"Navigated to the footer navigation.item.IsCurrentIs provided by AnQiCMS to determine whether the current navigation is active, which is very useful for highlighting the current navigation item on the page.item.Linkanditem.TitleThe navigation link's address and displayed text are obtained separately.

Summary

AnQiCMSofnavListtags and theirtypeIdParameters, it is a powerful tool for building flexible and variable website navigation. By carefully designing different "navigation categories" in the background, and utilizingtypeIdIn the template, call it accurately, and you can easily realize the exclusive navigation for the website header, footer, sidebar, and even specific functional modules.This greatly enhances the manageability and maintainability of the website, and also provides users with a clearer, more contextually appropriate browsing experience, thereby indirectly optimizing the overall operation of the website.


Frequently Asked Questions (FAQ)

  1. Q: How many navigation categories can I create in the AnQiCMS backend? A:AnQiCMS allows you to create the following

Related articles

How to create a new navigation category in the AnQiCMS backend, such as footer navigation or sidebar navigation?

## Unlock a new dimension of website layout: easily create custom navigation categories in AnQi CMS background As an experienced website operations expert, I am well aware of the importance of a flexible and efficient content management system for website success.AnQiCMS, with its high-performance architecture based on the Go language, modular design, and SEO-friendly features, has become the first choice for many small and medium-sized enterprises and content operation teams.Its strong performance in content management, not only reflected in the publication and management of core content such as articles and products, but also in its highly customizable navigation system

2025-11-07

How to determine the currently active (active) navigation item in the AnQiCMS navigation list?

As an experienced website operation expert, I fully understand the importance of navigation menus for user experience and website structure.An active navigation item that can clearly indicate the current position, not only can it improve the user's browsing efficiency, but also provide positive visual feedback.In such an efficient and user-friendly content management system as AnQiCMS (安企CMS), the realization of this feature is equally concise and powerful.Today, let's delve into how to cleverly judge and mark the currently active navigation item in the AnQiCMS navigation list, making your website navigation smarter and smoother

2025-11-07

How to use AnQiCMS navigation list tags to display two-level or multi-level menu structures?

The operation of a website is like steering a ship, and a clear navigation system is like a compass guiding the direction.In the world of content management, a high-efficiency, flexible navigation menu can not only greatly enhance the user experience, allowing visitors to navigate your website freely, but is also an important foundation for optimizing website structure and improving search engine friendliness.AnQiCMS (AnQiCMS) fully understands its way, providing users with a powerful and intuitive navigation list tag, making it easy to build a multi-level menu structure.Today, let's delve into how to skillfully use the `navList` tag in AnQiCMS

2025-11-07

What are the advantages of the "Flexible Content Model" project of AnQi CMS, and how is customization manifested on the front end through tags like `moduleDetail`??

## AnQi CMS: How to create a versatile front-end experience through `moduleDetail` and other tags As an experienced website operations expert, I know that the core value of a content management system (CMS) lies in its flexibility and adaptability.In today's rapidly changing digital marketing environment, a rigid, difficult-to-customize system undoubtedly becomes a fetter to corporate development.AnQiCMS (AnQiCMS) delivered a satisfactory answer to this challenge with its high-performance architecture based on the Go language

2025-11-07

How to get the link address and display name of the navigation item in the AnQiCMS template?

As an experienced website operations expert, I am well aware of the importance of an efficient and flexible CMS system for content operations.AnQiCMS with its powerful performance in Go language and the ease of use of the Django template engine indeed provides us with great convenience.Today, let's delve deeply into an important topic in website template development: how to accurately obtain the link address and display name of navigation items in AnQiCMS templates?

2025-11-07

How is the display order of AnQiCMS navigation menu items managed and adjusted in the backend?

As an experienced website operation expert, I am well-versed in all the functions of AnQiCMS, especially its design concepts in content management and user experience optimization.Today, let's delve into a seemingly simple but crucial feature for website structure and user experience: how the display order of AnQiCMS navigation menu items is managed and adjusted in the background.A clear and logical navigation menu is the foundation of a successful website.It not only helps users find the information they need quickly, but it is also an important basis for search engines to understand the structure of websites.

2025-11-07

Does AnQiCMS support adding external links in the navigation menu and how to set it up?

## SecureCMS Navigation Menu: Easily integrate external links to expand your website ecosystem In today's fast-paced digital world, an efficient and user-friendly website navigation system is undoubtedly a guiding light for users visiting the website.It not only guides visitors to deeply explore your content, but is also the key to connecting the brand ecosystem and enhancing the user experience.As an experienced website operations expert, I fully understand the importance of the flexibility of the navigation menu for content strategy, especially whether it can add external links.

2025-11-07

How to call the link of category page or single page in AnQiCMS navigation list?

The Anqi CMS plays a core role in website operations, and the navigation system is a guide for users to explore the website's content.A well-designed and convenient navigation not only enhances user experience but is also a key aspect of search engine optimization.Today, we will delve into how to flexibly integrate category pages and single-page links巧妙地融入到 websites navigation list.### Navigation Configuration: The Bridge from Backend to Frontend The navigation system of AnQiCMS is designed to be very intuitive and powerful, closely integrating the configuration of navigation with the call of front-end templates

2025-11-07