In the flexible and powerful template system of AnQiCMS, building website navigation is one of the fundamental tasks of content operation. We often encounter two seemingly similar tags with different focuses:categoryListandnavList.As an experienced website operation expert, I know how to skillfully utilize these tools according to the specific needs of the website to achieve ** an excellent user experience and content management efficiency.categoryListInsteadnavListCome to build website navigation.


Understand the foundation of navigation construction in AnQiCMS.

Firstly, let's briefly review.categoryListandnavListThe core functions of these two tags.

navListTag: Flexible global navigation tool.

navListIt is used to build website navigation lists, as the name implies.Its data source directly comes from the "Website Navigation Settings" module of the AnQiCMS backend.You can create multiple sets of navigation here, and add custom links to each set of navigation. These links can be internal pages, article/product model homepages, specific category pages, or even external links.navListSupports up to two levels of navigation structure, very suitable for building website main menus, footer menus, or general sidebar menus. Its advantages lie in:

  • Highly customizable:You can freely define the display name of the navigation items, the link address, and even add subheadings and descriptions.
  • Flexible:Can easily integrate various links, including links to external websites, or standalone single-page links (such as "About Us
  • Structure is stable:Navigation levels and content are manually configured by the backend, and are not directly affected by the amount of content published. They are suitable as the core, relatively fixed guidance entry of the website.

categoryList标签:深入内容结构的动态指南

categoryListTags are designed around the content model and classification system of AnQiCMS.Its data is directly extracted from the categories under the "Article ModelcategoryListCan dynamically list all child categories under a specified model and parent category, even getting the full site's categories. Its core advantage lies in:

  • Content-driven dynamics:When you add or adjust categories in the background,categoryListthe navigation structure will be updated automatically, without the need to manually modify the template code. This is particularly important for websites with frequent content updates.
  • Deep content exploration:Can easily achieve multi-level nested classification navigation, guiding users to delve into various content themes of the website layer by layer.
  • Closely integrated with content information:In addition to category names and links,categoryList还能直接提供分类的描述、缩略图、文档数量等信息,让导航不仅仅是链接,更是内容预览的一部分。
  • SEO friendly:The website's category structure is clearly mapped to the navigation, which helps search engines better understand the organization of the website's content, improving inclusion and ranking.

When should priority be givencategoryList?Core considerations

Understanding their characteristics, the timing becomes smooth as silk. You should prioritize usingcategoryListto build navigation, mainly including the following core scenarios:

  1. When the core purpose of navigation is to present the website's content classification system.

    • Typical scenario:Blog site article categories, e-commerce product categories, news portal channel categories, chapter directories of technical document websites, etc.
    • Reason:This website's users' main demand is to browse content by category.categoryListDirectly reflects the organization of the content, presenting these categories in the most intuitive and dynamic way, allowing users to quickly find topics of interest. For example, a food blog sidebar may need to display categories such as 'Home-style dishes', 'Baking', 'Western cuisine', and these categories may also continue to be subdivided, at this timecategoryListsimpleforLoop nesting can perfectly achieve this.
  2. When the navigation structure of the website needs to automatically adjust with the content update.

    • Typical scenario:New product lines, release of new content topics, adjustment of category levels, and other operations all hope that the navigation can synchronize in real time.
    • Reason: categoryListIt is dynamic. When you manage categories in the background, the navigation will update automatically, greatly reducing the workload of manual navigation maintenance by operation staff, and avoiding information lag or errors. If usingnavListEach time the classification changes, you need to manually modify it in the navigation settings, which is inefficient and prone to errors.
  3. When you need to use the additional information of the classification to enrich the navigation display.

    • Typical scenario:Display category thumbnails, brief descriptions, or the number of articles/products under the category in navigation.
    • Reason: categoryListofitemThe object provides rich category fields (such asThumb/Description/ArchiveCount),You can directly call these data in the template to make the navigation more vivid and informative.For example, on the product list page, the side navigation shows how many products each category has next to it, which can effectively guide users to click.
  4. When you need to build a model-specific navigation.

    • Typical scenario:The website has both articles and products, you need a navigation that only displays the "Products" category, or a navigation that only displays the "Articles" category.
    • Reason: categoryListCan be accessedmoduleIdParameters precisely specify which content model's categories to retrieve, allowing you to create dedicated navigation areas for different content types, without interference, with clear logic.

Summary: The core principle of selection.

In a nutshell, the principle of selection.categoryListOrnavListThe core principle lies in:What are the 'data source' and 'main service object' of navigation?

  • If your navigation mainly comes from the background presets, a relatively fixed set of links, and may include external or non-content categorized pages, thennavListit is your best choice.It is more like a meticulously planned guide map by hand.
  • If your navigation mainly comes from the content classification structure of the website, needs to be dynamically updated, and the purpose is to guide users to explore the content in depth, thencategoryListit is a more efficient and intelligent choice.It is more like a dynamic catalog that grows out of the content itself.

In practice, the two are not completely independent. Usually, a complex website will use both tags. For example, you can usenavListBuild the top-level main navigation of the website (including common links such as "HomecategoryListGenerate a detailed classification sidebar or secondary navigation dynamically to achieve deeper content browsing.Such a combination of punches ensures both the stability and flexibility of the main navigation and takes into account the dynamism and depth of content navigation.


Common Questions (FAQ)

1.navListCan the content category be displayed?Of course you can.navListSupport selecting "Category Page Link" as a navigation item.This method requires you to manually select each category in the background "Website Navigation Settings" and maintain its hierarchical relationship.categoryListIt is convenient to generate dynamically.

2.categoryListCan external links or standalone single-page links be added directly?It cannot be implemented directly.categoryListThe data source is strictly bound to the content classification system of AnQiCMS. It cannot be likenavListConfigure external links or single-page links for non-content categories directly. If you need to mix these types of links in the content category navigation, you may need tocategoryListThe generated category link as part of, then throughnavListor manually write HTML to add other types of links, or consider creating these "stand-alone" pages as a "single-page" document type under a specific category.

3. How to include a dynamic article category dropdown menu in the main navigation (using)navListbuild)?This is a common mixed usage scenario. You can innavListCreate a top-level navigation item named 'Article Center' or 'Blog', which links to the home page of the article model. Then, in the dropdown menu or submenu area of this navigation item,categoryListTags dynamically list all top-level categories or popular categories under the article model.Thus, users can quickly locate the article area through the main navigation and can also browse more precisely through the dynamically generated category menu.