How to set and display the navigation menu (top/bottom) of the AnQi CMS website?

Calendar 👁️ 57

The website navigation is the key path for users to explore the website content, and it is also an important reference for search engines to understand the website structure.In AnQiCMS (AnQiCMS), you can flexibly set up and manage the top and bottom navigation menus of the website to meet different design and functional needs.

This article will introduce in detail how to configure the navigation menu in the Anqi CMS backend, as well as how to display it in the website frontend template.

Part 1: Configure the navigation menu in the backend

In Anqi CMS, the navigation menu settings are concentrated in the "Background Settings" area of the backend, specifically the "Website Navigation Settings" feature.

1. Manage navigation categories

AnQi CMS allows you to create multiple independent navigation categories, which is very useful for managing menus at different locations (such as main navigation, footer navigation, sidebar navigation).

  1. Access the navigation category:After logging into the backend, go to the "Backend Settings" menu under "Navigation Settings", and you will see an option for "Navigation Category Management".
  2. Add a new category:Click to enter, the system will default to a 'Default Navigation' category.If you need an independent bottom navigation, you can click “Add Navigation Category”, enter a meaningful name, such as “Bottom Navigation” or “Footer Menu”, then save.
    • In this way, you can create exclusive navigation structures for different areas of the website, making it convenient for management and maintenance.

Section 2: Configure navigation links

After selecting or creating a navigation category, the next step is to add specific navigation links to the category. Each navigation link can be configured in detail:

  1. Select a navigation category:On the "Website Navigation Settings" page, first select the navigation category you want to configure (such as "Default Navigation" or the "Bottom Navigation" you created).
  2. Add/Edit navigation link:
    • Display name:This is the text that users see on the website front-end, it should be concise and clear, accurately reflecting the content of the link. For example, 'About Us', 'Product Center'.
    • Subtitle name:If your design requires, you can display a secondary title below the main title, such as 'Products' below 'Product'.
    • Navigation Description:Add a short description to the navigation item, which may be used to display hints in some template designs.
    • Link Type:Safe CMS provides three powerful link types to meet your needs for linking to different content:
      • Built-in links:A fixed page for the website, such as the homepage, article model homepage, product model homepage, or other custom model homepage. After selecting, the system will automatically generate the link.
      • Category page links:You can directly link to the article categories, product categories, or single pages on your website (such as the "Contact Us" page). Simply select the corresponding content.
      • External links:Provided the greatest flexibility, you can manually enter any internal or external URL address. This is very convenient for linking to third-party services or external cooperative websites.
    • Parent navigation:To create a dropdown menu or submenu, you simply need to set the 'parent navigation' to the corresponding parent menu item when adding the submenu item.The Anqi CMS supports two-level navigation (primary menu, secondary dropdown menu).
    • Display order:By adjusting the size of the number, you can control the arrangement order of navigation items at the same level. The smaller the number, the earlier it is displayed.

By following these steps, you can easily build a navigation menu that meets the website structure and user needs on the Anqi CMS backend.

Part two: Displaying the navigation menu in the front-end template.

After completing the navigation settings in the background, the next step is to display these navigation menus on the website front end using template tags. Anqi CMS is usednavListTo implement this feature, it has high flexibility and can adapt to various complex menu layouts.

1. UsenavListNavigation tag call

In your website template files (such as)header.htmlUsed for top navigation,footer.htmlUsed in the bottom navigation), you can usenavListtags to get the navigation data configured in the background.

A basic call method is as follows:

{% navList navs with typeId=1 %}
    <ul>
        {%- for item in navs %}
            <li><a href="{{ item.Link }}">{{item.Title}}</a></li>
        {% endfor %}
    </ul>
{% endnavList %}

here,navsis an array object that contains each navigation link you set up in the background.forThe loop will traverse these links,item.LinkGet the link address,item.TitleGet the display name.

  • typeIdparameters: typeIdIs a key parameter to specify which navigation category you want to call. By default,typeId=1It usually corresponds to the "default navigation" on the backend. If you have created other navigation categories (such as "bottom navigation"), when calling it, you need to refer to its actual position in the backend.typeIdSpecify. Check the navigation category ID on the "Website Navigation Settings" page, or pay attention to the ID when creating a new category in the "Navigation Category Management".

Second, implement a dropdown menu navigation

Of Security CMSnavListTags support the easy creation of secondary dropdown menus. Each main navigation item (item) may contain aNavListProperty, this property itself is also a navigation list, representing the sub-menu of its lower level.

You can achieve this by nestingforLoop to display these sub-menus:

{% navList navs with typeId=1 %}
    <ul class="main-menu">
        {%- for item in navs %}
            <li class="{% if item.IsCurrent %}active{% endif %}">
                <a href="{{ item.Link }}">{{item.Title}}</a>
                {%- if item.NavList %} {# 判断是否存在子菜单 #}
                    <dl class="sub-menu">
                        {%- for subItem in item.NavList %} {# 遍历子菜单 #}
                            <dd class="{% if subItem.IsCurrent %}active{% endif %}">
                                <a href="{{ subItem.Link }}">{{subItem.Title}}</a>
                            </dd>
                        {% endfor %}
                    </dl>
                {% endif %}
            </li>
        {% endfor %}
    </ul>
{% endnavList %}

The above code demonstrates how to judgeitem.NavListDoes it exist, if it exists then render a<dl>label as a submenu container and iterateitem.NavListthrough the submenu items.item.IsCurrentThe attribute can be used to determine whether the current navigation is active, which is convenient for adding styles.

3. Combined with content to dynamically display (advanced application)

For more advanced requirements, such as directly displaying a list of popular articles or product listings under a specific category in the navigation dropdown menu, you can combine other content tags likearchiveListorcategoryListTo implement this. It usually requires navigating to a specific category or page, and throughitem.PageIdto get the corresponding category or page ID.

For example, display the popular products under the category in a dropdown menu of a product category:

{% navList navList with typeId=1 %}
    <ul>
    {%- for item in navList %}
        <li>
            <a href="{{ item.Link }}">{{item.Title}}</a>
            {%- if item.NavList %}
            <ul class="nav-menu-child">
                {%- for inner in item.NavList %}
                <li>
                    <a href="{{ inner.Link }}">{{inner.Title}}</a>
                    {# 如果该二级导航项关联了分类(PageId > 0),则加载该分类下的产品列表 #}
                    {% if inner.PageId > 0 %}
                        {% archiveList products with type="list" categoryId=inner.PageId limit="8" %}
                        {% if products %}
                        <ul class="nav-menu-child-child">
                            {% for product in products %}
                            <li><a href="{{product.Link}}">{{product.Title}}</a></li>
                            {% endfor %}
                        </ul>
                        {% endif %}
                        {% endarchiveList %}
                    {% endif %}
                </li>
                {% endfor %}
            </ul>
            {% endif %}
        </li>
    {% endfor %}
    </ul>
{% endnavList %}

This example shows how to useinner.PageIdto callarchiveListLabels, thus dynamically displaying content in navigation, greatly enriching the functionality of the navigation menu.

Prompt with **practice

  • Keep it concise:Avoid too many main menu items and too deeply nested submenus to prevent users from feeling confused.
  • Semantic naming:The name of the navigation item should be clear and accurate, allowing users to understand the content it points to at a glance.
  • Consistency:Maintain the unity of navigation style and structure within the website to enhance the user experience.
  • Adapt for mobile:Ensure that the navigation menu displays and operates well on all devices, especially on mobile devices.
  • Search Engine Optimization (SEO):A reasonable navigation structure helps search engines crawl and understand website content, improving website ranking.

Summary

AnQi CMS provides intuitive, flexible, and powerful functionality for website navigation settings and display. Whether it is a simple top/bottom menu,

Related articles

How to implement lazy loading display effect of images in AnQi CMS article content?

In website operation, the speed of image loading is crucial for user experience and Search Engine Optimization (SEO).Especially when an article contains a large number of images, loading all images at once will significantly increase page loading time, consume user traffic, and may cause users to leave prematurely.At this moment, the Lazy Load (Lazy Load) image technology can fully show its prowess.The core idea of lazy loading is to only start loading images when they are about to enter the user's visible area, rather than loading all of them at the initial page load.

2025-11-08

How to use AnQi CMS template tags to get the document list under a specific category?

AnQiCMS (AnQiCMS) provides a solid foundation for flexible display of website content with its powerful template features.In website operation, we often encounter the need to display a list of documents under specific categories, such as news updates, product introductions, blog articles, and so on.Mastering how to utilize template tags to achieve this function will greatly enhance the organization efficiency and user experience of the website content.### Core Tag: The Usefulness of `archiveList` In AnQi CMS, you need to get the document list under a specific category

2025-11-08

How to customize the layout and content of the document detail page in AnQi CMS?

In Anqi CMS, the custom display layout and content of the document detail page are crucial for realizing website personalization and meeting specific business needs.The ultimate form of website content, detail pages not only carry core information but also directly affect user experience and search engine optimization effects.The AnQi CMS offers a highly flexible template mechanism and rich data tags, allowing users to easily create unique document detail pages according to their own creativity.

2025-11-08

How to call and display the latest article list in AnQi CMS?

As a feature-rich and easy-to-use content management system, AnQi CMS provides great flexibility in content display.When you need to show your visitors the latest articles on the website, such as on the homepage, sidebar, or specific topic pages, Anqi CMS can help you easily achieve this.To implement the "Display the latest article list in Anqi CMS", the core lies in flexibly using its powerful template tag system, especially the `archiveList` tag.

2025-11-08

How to configure and display SEO TDK information on the homepage of AnQi CMS?

In website operation, Search Engine Optimization (SEO) is the key to improving website visibility and attracting natural traffic.And TDK (Title, Description, Keywords) information, as the "business card" of website content on the search engine results page (SERP), its configuration rationality directly affects the user click-through rate and the search engine ranking performance.For users using AnQiCMS (AnQi CMS), the system is built with intuitive and powerful TDK configuration features, making homepage SEO optimization simple and efficient.###

2025-11-08

How to customize the URL static rules of AnQi CMS article pages to optimize SEO display?

In website operation, a clear and search engine-friendly URL address not only improves user experience but is also a key link in website SEO optimization.AnQiCMS (AnQiCMS) fully understands this and therefore provides a flexible and versatile custom static URL feature to help users easily create article page links that comply with SEO practices.### Overview of Anqi CMS's SEO-friendly URL capability SEO-friendly URL technology, as the name implies, is to make dynamic pages look like static pages with fixed and meaningful URLs

2025-11-08

What image processing methods does AnQi CMS support to optimize front-end display?

In today's website operation, images are not only an important part of content presentation, but also a key factor affecting the loading speed of the website and user experience.If image processing is not done properly, it may lead to slow page loading, which in turn can affect search engine rankings and user retention.AnQiCMS (AnQiCMS) fully understands this, therefore it has built-in a variety of practical image processing features to help us easily optimize the front-end display and improve website performance. ### Smart Thumbnail Generation and Fine Management AnQi CMS provides a very flexible thumbnail processing mechanism.When we upload images

2025-11-08

How to set custom thumbnails and display them for documents and categories in AnQi CMS?

In content operation, an attractive thumbnail often determines whether a user clicks to view the full content. It is not only the 'facade' of the content but also an important element in improving the visual effects of the website and the search engine friendliness.AnQi CMS is a powerful content management system that provides a flexible way for you to set custom thumbnails for documents and categories, and can be easily displayed on the front page, thereby effectively enhancing the attractiveness of your content.Next, we will delve into how to implement this feature in Anqi CMS.### The Importance of Thumbnails

2025-11-08