AnQiCMS navigation item inPageIdField: When does it unleash the magic of its precise navigation?

In AnQiCMS (AnQiCMS) such a rich-featured and highly customizable content management system, each configuration item carries a specific mission.Navigation serves as the skeleton of a website, its importance is self-evident.PageIdThe field. This field is not always active, it is only activated in specific scenarios, playing a unique role in precisely linking content. As a senior website operator, understandingPageIdThe mechanism, which can help us manage website content more efficiently, ensuring the accuracy and maintainability of navigation.

In short, the navigation items in AnQiCMS includePageIdField, dedicated to serving those who needAccurately points to specific content entities within the websiteThe navigation link. It is not a generic link identifier, but is closely associated with the "Categories" and "Single Page" in the content model.

PageIdAppearance: When the link type points to internal content

When we are in the AnQiCMS backend, through the 'Navigation Settings' to create or edit a navigation item, the system will provide a variety of 'link types' for us to choose from.This includes 'Built-in links' (such as the homepage of the website), 'External links' (pointing to URLs of other websites), and most importantly - 'Category page links'.

It is when we choose the 'category page link' type,PageIdThe field is officially enabled.This means that you want this navigation item to be more than just a simple text link, but to be directly associated with a specific category in your website's backend management (such as "News

Once you select a category or a single page from the dropdown list, AnQiCMS will intelligently fill in the category or single page'sunique IDautomaticallyPageIdIn the field. This ID, whether it is a category ID or a single page ID, will become the core basis for the system to identify the content it refers to within the navigation item.

PageIdThe practical application: content linkage and template dynamic display

PageIdThe value, not only lies in recording the ID of a content, but also in bringing powerful dynamic content linkage capabilities to the front-end template. Through the template tags provided by AnQiCMS, such asnavListWe can easily get the navigation item on the front-end pagePageIdValue.

For example, suppose you created a navigation named "Latest News" and set its link type to "Category Page Link", then selected the article category with ID 10. At this point, this navigation item'sPageIdIt stored "10". In the front-end template, when you iterate over the navigation list, you can use it like this:

{% navList navList with typeId=1 %}
{%- for item in navList %}
    <li>
        <a href="{{ item.Link }}">{{item.Title}}</a>
        {%- if item.PageId > 0 %} {# 判断PageId是否存在且有效 #}
            {# 如果当前导航项关联的是一个分类,且我们想展示该分类下的部分文章 #}
            {% archiveList articles with type="list" categoryId=item.PageId limit="5" %}
                <ul>
                    {% for article in articles %}
                        <li><a href="{{article.Link}}">{{article.Title}}</a></li>
                    {% endfor %}
                </ul>
            {% endarchiveList %}
        {% endif %}
    </li>
{% endfor %}
{% endnavList %}

In this code block,item.PageId(which is category ID 10) was passed to thearchiveListlabel'scategoryIdParameters dynamically pull and display the latest 5 articles under the "Latest News" category.This association method based on ID makes navigation not only a link but also an entry point for content aggregation.

Similarly, if a navigation item'sPageIdThis corresponds to a single page (such as the "About Us" page, ID 5), although we usually do not directly display the child content in the navigation dropdown, but developers can make use of thisPageIdWrite more intelligent template logic. For example, based on the currently active navigation item'sPageIdLoad different background images, sidebar modules, and even call other data related to the single-page ID dynamicallly.

PageIdWhen to 'sleep': scenes involving built-in and external links.

Of course,PageIdNot a necessity for all navigation items. When the navigation item link type is set to:

  • Built-in linkFor example, it points to the homepage of a website or the homepage of a content model (such as “All Articles” These links have fixed system routing rules, do notPageIdspecify specific content.
  • External link: Points to a URL of another website. In this case, the navigation item directly stores a complete external URL,PageIdit is naturally useless.

In these cases,PageIdThe field is either empty or its value is ignored, which does not affect the actual navigation function.

Summarize the value to the user

Therefore, the AnQiCMS navigation items'PageIdThe field is an identifier that focuses on precise links to internal content (categories and single pages).It becomes effective when you select the 'Category Page Link', storing the unique ID of the selected content entity.This design greatly enhances the flexibility and dynamic nature of website navigation, allowing the front-end template to intelligently display related content based on navigation items, and also provides website operators with more powerful content organization and maintenance tools, avoiding the inconvenience that may arise from hard-coded URLs.PageIdThe operation mode will undoubtedly enable you to operate more steadily and efficiently on the content operation path of AnQiCMS.


Frequently Asked Questions (FAQ)

Q1:PageIdand the navigation items.LinkWhat is the difference between the fields? Which should I focus on?

PageIdandLinkAre two different dimensions that are interrelated concepts.PageIdStores a specific category or single page within your website.Unique numeric IDIt is an identifier at the content level. AndLinkThe field stores the finalaccessible URL path. When you select the “Category Page Link” and associate it with specific content, the system will use the content'sPageIdand the pseudo-static rules of the current website, automatically generatedLinkField. In most cases, you should focus on setting the correct "link type" and associated "category/page", so that the system can manage automaticallyPageIdandLink.PageIdMore used for advanced dynamic content display logic in templates, whileLinkIs the address where users directly click to visit.

Q2: Can I manually modify the navigation items?PageIdIs it? What risks are there in manually modifying?

Theoretically, background operations may allow you to enter or modifyPageIdbut westrongly advise againstmanually modifying.PageIdAlways use the "Category Page Link" option in the background navigation settings and select a specific category or single page from the dropdown list to automatically fill in. If you manually enter an ID that does not exist or arbitrarily modify it to a mismatched ID, the navigation link may fail, or although it may jump on the surface, becausePageIdThe content does not match the actual content, which leads to the front-end template not being able to correctly obtain and display related content, resulting in blank or error messages.The correct approach is to select the link type and target category/page again if you need to change the content that the navigation points to.

Q3:PageIdIs it only applicable to articles or product categories? If I want to link to the list page of other custom content models,PageIdwill it take effect?

PageIdThe scope is the content entities covered by the 'category page link', which usually includesAll categories under the content modelsandsingle pageTherefore, if your AnQiCMS system has custom content models (such as "cases", "services", etc.) and has created categories for these models, then you can associate navigation items with any category under these custom models, at this timePageIdRecords the ID of the category. As for directly linking to a custom content model.List page (non-category)This usually belongs to the category of 'built-in links', generated by the system through model aliases and other methods at this timePageIdusually will not take effect.