How to create and manage a website navigation menu and implement the display of secondary navigation?

Calendar 👁️ 98

The website's navigation menu, which is like the skeleton and landmark of the website, guides visitors to quickly find the information they need, and is the core of user experience and website information architecture.A clear and intuitive navigation system not only enhances user satisfaction, but is also crucial for search engine optimization (SEO).AnQiCMS (AnQiCMS) took this into consideration from the beginning of its design, providing a flexible and easy-to-operate navigation menu management function, allowing website operators to easily build and maintain the website's navigation system.

Building the main navigation of a website: from zero to one practice

To create and manage website navigation in Anqi CMS, we first need to enter the system's backend management interface.Find and click on the "Background Settings" in the menu on the left, then select "Navigation Settings" next.This is where we control the website menu.

AnQi CMS has categorized the navigation menu, by default there will be a 'Default Navigation' category, which is usually the main navigation of our website.If you have special requirements, such as placing a set of independent navigation menus in the footer or sidebar, you can add categories through the "Navigation Category Management", such as creating "Footer Navigation" or "Sidebar Navigation", which greatly increases the flexibility of navigation layout.

Next, we can start adding navigation links. Click the "Navigation Link Settings" and you will see a form to add or edit navigation items.

  • display nameThis is the text directly displayed on the navigation menu for visitors, such as 'Home', 'Product Center', 'About Us'. You can name it freely according to your actual needs.
  • Subheading nameIf you want to display bilingual titles in navigation, or add some additional brief descriptions to the title, this field can come in handy.
  • Navigation descriptionHere you can provide a more detailed description for the navigation items, although it is usually not displayed directly in the navigation bar, but it may appear as a mouse hover tip in some thematic designs.
  • Link TypeThis is the core definition of where the navigation points. Anqi CMS provides three flexible link types:
    • Built-in linkIncluding 'home link', various 'content model home pages' (such as article model home page, product model home page, etc.), these are the commonly used entry points preset by the system.
    • Category page link: You can select existing article categories, product categories, or single pages as navigation targets. This means that your content structure can be directly mapped to the navigation.
    • External linkIf you want to link to a specific page within the site or an external website, you can use this option. Just enter the complete URL address.
  • Display orderThis field is used to control the order of navigation items. Typically, the smaller the number, the closer the navigation item is to the front of the menu. You can adjust these numbers to easily reorder.

By following these steps, we can add the first-level navigation menu items of the website one by one.

Achieve a clever display of the second-level navigation.

The Anqi CMS supports the creation and display of secondary navigation menus natively, which is crucial for building a clear hierarchical website structure.The key to implementing secondary navigation is to make use of the 'parent navigation' field.

When adding a new navigation link, if you want it to be a submenu under a first-level navigation, just select the corresponding first-level navigation in the "Parent Navigation" field.For example, if you have a top-level navigation named "Product Center" and you want to add submenus such as "Product A", "Product B", etc. under it, then when creating the navigation links for "Product A" and "Product B", set their "parent navigation" to "Product Center".The AnQi CMS automatically recognizes this level relationship.

The settings on the back-end are merely to define the logical structure of navigation. To actually display the secondary navigation effect on the website front-end page, support at the template level is also needed. The template engine of Anqi CMS provides powerfulnavListTags that make front-end calls very convenient.

In your template file (usually)header.htmlor the part that includes the main navigation), you can usenavListtags to get the navigation list:

{% navList navs %}
<ul>
    {%- for item in navs %}
        <li class="{% if item.IsCurrent %}active{% endif %}">
            <a href="{{ item.Link }}">{{item.Title}}</a>
            {%- if item.NavList %} {# 判断是否有二级导航 #}
            <dl> {# 或者使用ul/ol,根据你的HTML结构来 #}
                {%- 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 %}

In this code block:

  1. {% navList navs %}Retrieved all navigation menus configured on the backend and assigned them tonavsVariable.
  2. The firstforLoop throughnavsto render the first-level navigation items.item.Titleanditem.LinkUsed to display titles and links.item.IsCurrentIt can be used to determine if the current page is the navigation item so that styles can be added.
  3. {%- if item.NavList %}It is the key to achieving secondary navigation.item.NavListIs a boolean value, if the current level navigation item contains sub-navigation, it will betrue.
  4. Ifitem.NavListWithtrueThen the second insideforThe loop will iterate over all the sub-navigation items of the current level navigation item (item.NavListRender the content of the second-level menu.

By this nested structure, your website navigation can clearly display the first and second-level menus, thereby providing a richer and more friendly user browsing experience.In addition, you can also embed content categories under the secondary navigation according to your needs, or deeper classifications, making full use of the flexibility of the Anqi CMS content model.

Maintenance and optimization of the navigation menu.

Creating a navigation menu is not a one-time task, as the website content increases and the business develops, the navigation menu also needs continuous maintenance and optimization.In Anqi CMS, you can always return to the "Navigation Settings" page to edit, delete, or adjust the order of existing navigation items.For example, by modifying the 'Display Order', you can quickly adjust the position of menu items without touching any code.

When designing navigation, it is also important to consider search engine optimization.Use meaningful keywords as navigation names, ensure link accessibility, and avoid deep navigation levels (original two levels are already very friendly), all of which help to improve the website's SEO performance.The static and SEO tools built into AnQi CMS also provide a solid foundation for optimizing navigation links.

In summary, AnQi CMS provides an intuitive and powerful navigation menu management system. Whether it's a simple single-layer menu or a complex two-level navigation, it can be easily configured in the background and presented perfectly on the front end through flexible template tags.This makes the website's structure planning and content presentation efficient and creative.


Frequently Asked Questions (FAQ)

1. Does Anqi CMS support creating third-level or higher-level navigation menus?The AnQi CMS natively supports the creation and management of two-level navigation menus in the background settings. Although it does not directly provide an entry for background configuration of three levels or more, you can combine the category management feature and custom template tags (such as calling again under the second-level navigation).categoryListTo display its sub-categories, realize a more complex navigation structure, but this requires certain template development capabilities.

2. How to adjust the display order of the navigation menu?On the Anqi CMS backend's 'Navigation Settings' page, each navigation link has a 'Display Order' field.By adjusting the size of the number in this field, you can control the arrangement order of the navigation menu items.As a rule, the smaller the number, the earlier the navigation item will be displayed in the menu.

3. Can I set a menu different from the main navigation in the footer or sidebar?It is completely possible. Anqi CMS provides the 'Navigation Category Management' feature.In addition to the default main navigation category, you can create new navigation categories as needed, such as "Footer navigation", "Sidebar navigation", and so on.Then, add and manage links for these different navigation categories and specify in the templatetypeIdThe parameter'snavListLabels to call them.

Related articles

How to control whether the website name suffix is displayed in the homepage title TDK tag?

If you are using AnQiCMS to build or manage your website, you may encounter a common and important issue: how to finely control whether the website name is displayed as a suffix in the `<title>` tag on the home page.This not only concerns the display effect of the website in search engine results, but also directly affects users' perception of the brand.The AnQi CMS, as a content management system that focuses on SEO optimization and flexibility, provides simple and powerful control capabilities in this aspect.First, let's clarify what is meant by the "website name suffix" mentioned here

2025-11-07

How to dynamically display Title, Keywords, and Description on the homepage to optimize SEO?

It is the first step in building a successful website to make it search engine friendly.And Title (title), Keywords (keywords), and Description (description) - usually abbreviated as TDK - are the core elements of a website's dialogue with search engines.They not only tell search engines about the content of your page, but also directly affect whether users click on your website in the search results.AnQi CMS knows this, and therefore built-in powerful TDK management features, allowing you to easily achieve the dynamic display and optimization of TDK.

2025-11-07

How to customize contact information parameters in AnqiCMS and call them to display in the template?

It is crucial to maintain smooth communication with users in website operation.In addition to traditional contact methods such as phone and email, we often need to display more personalized social media or instant messaging information.AnqiCMS provides a very flexible contact information management module that allows you to easily customize and flexibly display this information at any location on the website.Next, we will divide it into two main steps to explain in detail how to customize contact information parameters in AnqiCMS and call them to display in the template.### One, in AnqiCMS

2025-11-07

How to retrieve and display the contact, phone number, address, and other information configured in the background?

It is crucial to clearly display a company's contact information in website operations to establish customer trust and promote communication.Whether it is the contact name, phone number, office address, or social media account, this information needs to be easily accessible to users in a prominent position on the website.The AnQi CMS provides a convenient solution, allowing you to manage and display these key information flexibly without writing complex code. ### Configure your contact information in the background The Anqi CMS backend is designed to make it easy for you to manage your website content, including your contact information.

2025-11-07

How to judge the current link status in the navigation list tags and add a highlight style?

In website operation, clear navigation is a key factor in improving user experience.When users can intuitively see their location on the current page, it not only reduces the sense of being lost but also improves the professionalism and usability of the website.Adding a highlight style to the current link in the navigation bar is a very effective way to achieve this goal.In Anqi CMS, highlighting the current link of the navigation item is actually simpler and more direct than you imagine.

2025-11-07

How to dynamically display the list of articles or products under a category in the navigation dropdown menu?

AnQi CMS: Build dynamic dropdown navigation menus to make content easily accessible In website operation, the navigation menu is the starting point for users to explore website content, and it is also an important clue for search engines to understand the website structure.The traditional navigation menu is often fixed links, when the website content becomes increasingly rich, especially when there are many articles and product types, manually maintaining the content list in the dropdown menu becomes particularly繁琐 and prone to errors.The AnQi CMS provides us with an elegant and efficient solution with its powerful content management capabilities

2025-11-07

How to manage and display all documents in AnqiCMS and support filtering by title, model, and category?

In the era of explosive digital content, efficiently managing and displaying website documents is a core challenge for every operator.When you have a vast amount of articles, product descriptions, service instructions, or any form of site content, how to ensure that these contents are organized, easy to find, and can be filtered according to different needs, is directly related to user experience and operational efficiency.AnqiCMS, as a system specially designed for enterprise content management, provides a powerful and flexible solution in this aspect.

2025-11-07

How to display thumbnails, descriptions, and custom fields on the document list page?

In website operation, the content list page is a key link for users to obtain information and decide whether to delve deeper into browsing.A richly informative, well-structured list page that can greatly enhance user experience and content appeal.It is particularly important to display thumbnails, descriptions, and custom fields reasonably in the document list page of Anqi CMS to achieve this goal.Through the powerful and flexible template tag system provided by Anqi CMS, you can easily meet this requirement without complex programming knowledge, just need to make simple modifications and configurations to the template file.

2025-11-07