How to build and display a multi-level navigation menu using the `navList` tag on the AnQiCMS website?

Calendar 👁️ 62

Website navigation is an important guide for users when they visit a website, not only helping users find the information they need quickly, but also reflecting the clear structure and friendly user experience of the website. Building flexible and diverse navigation menus in AnQiCMS is a relatively simple and efficient task, which is mainly due to its powerful featuresnavListLabel. Whether it is a simple single-layer menu or a complex two-level dropdown menu,navListLabels can provide strong support.

navListLabel: The core tool for building navigation

navListThe tag is a core tag used in the AnQiCMS template system to retrieve and display navigation menu data.It is responsible for extracting the configured navigation information from the background and providing it to the front-end template in a structured manner.

Basic usage and parameters:

UsenavListThe label is very intuitive, its basic structure is as follows:

{% navList navs %}
    {# 在这里循环遍历导航项 #}
{% endnavList %}

Here, navsIt is a variable name that you can customize, which will carry all the navigation data obtained from the background.{% navList %}and{% endnavList %}The tag identifies the range of navigation data acquisition.

navListThe tag also supports the following parameters to meet different navigation call requirements:

  • typeId:This parameter allows you to specify the navigation category to be called. AnQiCMS backend supports creating multiple navigation categories (for example, you can set a "top navigation" for the main menu, and a "footer navigation" for the bottom links).By setting differenttypeIdYou can display independent navigation menus at different locations on the website. By default,typeIdis 1, corresponding to the "default navigation" in the background.
  • siteId:If your AnQiCMS system manages multiple sites and you want to call navigation data defined by other sites in the current template, you can usesiteIdParameters to specify the ID of the target site.

Navigation data structure:

navsA variable is an array, where each element (we usually name it in the loop)item) represents a navigation item. Each navigation item includes the following key information:

  • Title:The text displayed on the front-end for navigation links, such as 'Home', 'Product Center'.
  • Link:The target URL address after the navigation item is clicked.
  • IsCurrent:A boolean value (trueorfalseIndicates whether the current navigation item matches the URL of the page being visited by the user. This field is very useful for highlighting the corresponding navigation item for the current page.
  • PageId:If the navigation item links to a category or single page within the AnQiCMS,PageIdWill store the ID of the category or page. This provides convenience for subsequent combination with other tags to implement more complex functions (such as displaying articles under the category in the navigation dropdown menu).
  • NavList: This is the core of implementing multi-level navigation!If the current navigation item has a submenu,NavListThe field will be a new array containing all the sub-navigation items.The data structure of the child navigation item is exactly the same as that of the parent navigation item, which means you can easily build a multi-level menu by nesting loops.

Backend configuration: building the navigation skeleton

In AnQiCMS,navListTags are powerful in function, but their data source depends on the careful configuration of the background. The following are the key steps to build the navigation skeleton.

  1. Enter the navigation settings:Log in to the AnQiCMS backend,

Related articles

How to dynamically generate and display the page's Title, Keywords, and Description in AnQiCMS using the `tdk` tag?

In website operation, Title, Keywords, and Description (abbreviated as TDK) are the foundation of Search Engine Optimization (SEO).They not only describe the page content to search engines, but also directly affect the click intention of users on the search results page.AnQiCMS as a content management system focused on, deeply understands the importance of TDK, and therefore provides a powerful and flexible mechanism that allows users to easily dynamically generate and finely manage the website TDK.### How to manage TDK in AnQiCMS

2025-11-08

How does the `contact` tag display contacts, phone numbers, addresses, and social media links on the AnQiCMS page?

In website operation, clearly and accurately displaying contact information is crucial for building user trust and promoting communication and interaction.AnQiCMS provides a very convenient way to manage and display this information, that is, through the `contact` tag.This tag helps us easily call the preset contact name, phone number, address, and even social media links on any page of the website, without hard coding, greatly improving content management efficiency.### First step: Configure contact information in the AnQiCMS backend Before we start using `contact`

2025-11-08

How does the `system` tag display the website name, Logo, record number, and copyright information on the AnQiCMS website?

When building and operating a website, the website's name, logo, filing number, and copyright information are important elements that constitute the professional image and legality of the website.They are not only the identity of the website, but also the foundation of user trust.For users of AnQiCMS, the system provides a convenient and efficient way to manage and display these core information, which is through the powerful `system` tag.This article will delve into how to use the `system` tag on the AnQiCMS website to flexibly display the website name, Logo, filing number, and copyright information

2025-11-08

What naming conventions do AnQiCMS template files support to customize the display of specific pages or categories?

In AnQiCMS, in order to achieve personalized display of website pages or categories, we do not always have to write complex logic from scratch. The system provides a very flexible and intuitive naming convention for template files.These conventions allow us to create template files with specific names, enabling the system to automatically recognize and apply them to customize the display of different content types.First, understanding the basic structure of the template file is crucial.All template files are stored in the `/template` directory and use `.html` as the file extension.For example, a set named

2025-11-08

How does the `breadcrumb` tag display the breadcrumb navigation path of the AnQiCMS page?

In website operation, clear navigation is a key factor in improving user experience and helping search engines understand the structure of the website.This is a direct navigation aid that can clearly show the hierarchical path of the current page, allowing visitors to always know where they are and where they can go.For users who use AnQiCMS to build and manage websites, achieving such navigation is simple and efficient, thanks to its built-in `breadcrumb` tag.###

2025-11-08

How to retrieve and display the list of AnQiCMS articles or product categories using the `categoryList` tag?

Build a feature-rich, content-packed website in AnQiCMS, categories are an indispensable part of organizing content.Whether it is to display articles, products, services, or build navigation menus, a clear classification structure can greatly enhance the user experience and maintainability of the website.Today, let's delve deeply into a very practical and flexible tag in AnQiCMS——`categoryList`, which can help you easily obtain and display a list of articles or product categories.The `categoryList` tag is a powerful tool in the AnQiCMS template engine

2025-11-08

How does the `categoryDetail` tag display the specific category details of AnQiCMS, such as the introduction or Banner image?

In Anqi CMS template development, effectively displaying detailed category information is the key to improving website user experience and SEO performance.`categoryDetail` tag is born for this, it allows us to flexibly obtain and present various information of specific categories, from basic introduction text to visually stunning Banner images, it can easily handle.### Core Function Analysis: `categoryDetail` Tag Overview The `categoryDetail` tag is mainly used to obtain detailed data for a single category

2025-11-08

How to get and display the list of all single pages of AnQiCMS using the `pageList` tag?

In Anqi CMS, a single page is a very flexible content form that does not rely on complex classification or model structures. It is often used to publish independent and relatively fixed pages such as "About Us", "Contact Information", and "Service Introduction".These pages are characterized by independent content, usually requiring only one page to carry their information.When you need to display a list of single pages at specific locations on a website, such as the bottom navigation, sidebar, or a special topic page, Anqi CMS provides a dedicated `pageList` tag to make this operation simple and intuitive.###

2025-11-08