How to customize the website navigation menu and control its display order and level relationship at different positions on the website?

Calendar 👁️ 124

The website navigation is a map for users to browse the website, not only guiding users to find the information they need, but also reflecting the structure of the website and the user experience.In Anqi CMS, customizing and managing the website's navigation menu, including their display order and hierarchy, is a flexible and efficient operation.In order to optimize the user experience, or to better support content marketing and SEO strategies, Anqi CMS provides powerful and intuitive tools.

Next, we will explore how to refine the customization of your website navigation in Anqi CMS together.

I. Backend operations: build and manage the skeleton of the navigation menu.

The website navigation settings start from the Anqi CMS backend management interface.Log in to the backend and you will find a 'Navigation Settings' option under the 'Backend Settings' menu, which is where you create and manage all navigation menus.

1. Navigation category management: Define different menu areas

Different locations of the website, such as the main navigation at the top of the page, the auxiliary navigation at the footer, or the functional navigation in the sidebar, often need to display different menus.The Anqi CMS fully considers this diversity and provides the 'Navigation Category Management' feature.

By default, the system will have a "default navigation" category.If you want to create a separate menu for the footer, you can click "Add Navigation Category" and name it "Footer Navigation" or any other name that is easy for you to identify.This allows you to create and manage independent navigation menus for different display areas of the website.

2. Navigation link setup: Fill menu content and hierarchy

After selecting or creating a navigation category, you can start adding specific navigation links to this menu.Each navigation link has rich configuration options, allowing you to precisely control its behavior and appearance.

  • Parent navigation: Establish hierarchy relationshipThis is the key to controlling the menu hierarchy.If you want to add a main menu item (level 1 menu), you usually choose 'top navigation'.If you want to create a secondary submenu, for example, add "Company Profile" under "About UsThe AnQi CMS currently supports two-level navigation links, that is, the main menu and its sub-menus at the next level.

  • Display name, subtitle name and navigation description: rich display informationThe display name is the text presented to the user as the navigation link on the front page.You can set it flexibly to make it more attractive. If your website needs a richer information display, such as showing both Chinese and English names at the same time, or providing a brief description for a menu item, then 'subheading name' and 'navigation description' can come in handy.They can make your navigation not only clear but also convey more information.

  • Link type: points to different targetsThe Anqi CMS provides three main link types to meet your needs for navigating to different content:

    • Built-in links:This type can directly point to the homepage of the website, the article model homepage, the product model homepage, or the homepage of any custom model.This is very convenient for quickly adding the entry point of the core page.
    • Category page links:This is one of the most commonly used link types, allowing you to select a created document category (such as "News Update", "Product Center") or a single page (such as "Contact Us", "Service Introduction") as the navigation target.The system will automatically generate the corresponding link.
    • External links:When you need to direct users to other websites outside the station, or some in-station pages not managed by the unsecure CMS, you can use external links.Just enter the complete URL address.
  • Display order: Custom sorting orderTo arrange the navigation menu items in the order you expect, you can control it through the 'Display Order' field.This field accepts numbers, the smaller the number, the earlier the menu item is displayed in the same-level menu.For example, if you want “About Us” to be listed before “Product Center”, just set the display order of “About Us” to a smaller number than that of “Product Center”.

By setting this above, you can build a clear and rich navigation menu skeleton for different locations on the website.

Second, front-end display: make the navigation menu come alive on the website

After carefully setting up the navigation menu in the background, it is also necessary to call and render it to the front page of the website through template tags.AnQi CMS uses a syntax similar to the Django template engine, providing simple and efficient tags to complete this task.

1.navListTag: the heart of navigation data

Anqi CMS provides a very core and practical template tag -navListIt is used specifically to call the background configuration navigation data.

You can use it like this:

{% navList navs with typeId=1 %}
    {# 你的导航循环内容 #}
{% endnavList %}

HerenavsIt is the variable name you define for navigation data, and you can name it according to your preference.typeId=1It is a key parameter that tells the system which 'navigation category' data you want to call. The default 'default navigation' usually corresponds totypeId=1If you have created a new category named "Footer Navigation" in the background, itstypeIdmay be 2 or higher, and should be replaced according to the actual situation.

2. Loop traversal and hierarchical display

navListThe tag returns an array object containing all navigation items. You need to usefora loop to iterate over these navigation items and render them:

<ul class="main-nav">
    {% navList navs with typeId=1 %}
        {% for item in navs %}
            <li class="{% if item.IsCurrent %}active{% endif %}">
                <a href="{{ item.Link }}">{{ item.Title }}</a>
                {% if item.NavList %} {# 判断是否有子导航 #}
                <dl class="sub-nav">
                    {% 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 %}
    {% endnavList %}
</ul>

In this example:

  • {% for item in navs %}Iterate over the main navigation items.
  • item.Linkanditem.TitleUsed to output navigation links and display names.
  • {% if item.IsCurrent %}active{% endif %}It is a very practical technique that checks whether the current navigation item matches the page the user is visiting. If it matches, it will addactiveThis CSS class, you can use this class to design the current page

Related articles

How to set and display the global contact information (phone, address, email, social media, etc.) of AnQiCMS?

In website operation, clear and convenient contact information is the key to building trust and promoting communication.Whether it is a phone number, address, email, or increasingly important social media channels, this information needs to be prominently and consistently displayed on your website.AnQiCMS knows this, therefore it provides a直观且集中的 way to manage the global contact information of the website, allowing your visitors to easily find you wherever and whenever.

2025-11-08

How to configure independent templates, SEO information, and content display for single pages (such as "About Us", "Contact Us")?

When operating a website, some seemingly simple single pages, such as 'About Us', 'Contact Us', or 'Terms of Service', carry the brand image, trust endorsement, and user conversion entry of the website.Independently design a visual style for these pages, optimize their search engine (SEO) information, and flexibly display content, which is crucial for enhancing user experience and the professionalism of the website.AnQiCMS provides powerful and flexible features that allow you to easily meet these needs.### Core Function: Customize Exclusive Experience for Single Page First, let's understand how to use AnQiCMS

2025-11-08

How does image resource management in AnQiCMS affect the display quality and loading speed of front-end images?

In the process of running a website, images play a crucial role.They are not only part of the content presentation, but also a key factor affecting user experience and website performance.AnQiCMS (AnQiCMS) provides a series of practical functions in image resource management, which are directly related to the display quality and loading speed of the pictures on our website's front end.Deeply understand and make good use of these tools, which can help us build a website that is both beautiful and efficient.Why is image management crucial for a website?

2025-11-08

How to implement pagination display of article lists in AnQiCMS and customize the style and logic of pagination navigation?

AnQiCMS as an efficient and flexible content management system provides intuitive and powerful functions for handling article lists and pagination display, allowing content presentation to meet user needs and various customized scenarios.If you are using AnQiCMS to build a website and want to implement pagination for the article list, and finely control the style and logic of the pagination navigation, then the following content will explain the implementation method in detail.

2025-11-08

How does AnQiCMS automatically generate Sitemap and configure Robots.txt to optimize search engines' crawling and display of website content?

Search engine optimization (SEO) is the cornerstone of any website's success, and Sitemap and Robots.txt files are the key tools we use to communicate with search engines.They are like the 'instruction manual' and 'traffic rules' of a website, helping search engines efficiently and accurately crawl and display our content. 幸运的是,AnQiCMS was well thought out from the beginning of its design, built-in powerful SEO tools, making these seemingly complex operations extremely simple. Next

2025-11-08

How to display友情链接 in front-end and add nofollow attribute according to needs?

Manage and display friend links in Anqi CMS, which not only helps to enrich the external connections of the website, but also is a delicate operation that needs to be fine-tuned during SEO optimization.It is particularly important to flexibly control the `nofollow` attribute according to requirements, which is crucial for maintaining the health of website links and the transmission of weight.Our Aiqi CMS provides intuitive and powerful features, allowing us to easily achieve these goals.--- ### Configure friend links in AnQi CMS backend Firstly, all the friend links displayed on the front end cannot be separated from the detailed configuration in the backend

2025-11-08

How to enable and display the captcha function correctly in the website's comment and message form?

When running a website, spam comments and malicious messages often cause headaches.They not only affect user experience, but may also consume server resources, and even reduce the professional image of the website. 幸运的是,AnQi CMS内置了验证码功能,可以帮助我们有效过滤这些不速之客,让网站环境更加清朗。Below, we will learn together how to enable and display the captcha function correctly in the website's comment and message form. ### Step 1: Enable captcha feature in the background First, we need to go to the management interface of the website background.Find 'Function Management' in the left navigation bar

2025-11-08

How to overview the key operational data display of the AnQiCMS backend homepage (such as document quantity, visit trend, inclusion situation)?

The AnQi CMS backend homepage: A smart overview of website operations In the ever-changing internet environment, an efficient and intuitive website operation backend is undoubtedly the key to controlling the overall situation for operators.AnQiCMS (AnQiCMS) fully understands this, and the design philosophy of its backend homepage is to present the core operational data of the website in a clear and easy-to-understand way in front of you, so that you can have a clear understanding of the health status and operational performance of the website at the first time.

2025-11-08