As an experienced website operation expert, I am well aware of the efficiency and flexibility of AnQi CMS in content management. Today, let's delve into an important member of the AnQi CMS template tag system -pageListLabels, especially those that are retrieved by default from which single-page data on the website. Understanding this is crucial for our efficient content presentation and template design.


In-depth analysis of AnQi CMSpageListLabel: What single-page data is retrieved by default?

In the world of AnQiCMS, the single-page (Page) plays a role in the website that is relatively static, independent in content, but indispensable, such as "About Us", "Contact Us", "Privacy Policy", and so on.They do not update as frequently as articles or products, but they carry the basic information and brand image of the website.To facilitate developers and operators to flexibly call and display these single-page applications, AnQiCMS provides intuitive and powerfulpageList.

Get to knowpageListThe core role of tags

pageListThe label, as the name suggests, is mainly responsible for retrieving the list of single-page pages on the website.Its design philosophy embodies the simplicity and efficiency of AnQiCMS.In the template, we usually use{% pageList pages %}...{% endpageList %}Use this structure, among other things,pagesIs the variable name defined for the collection of single-page data obtained.

Core revelation:pageListthe default behavior

Now, let's hit the core of the topic:pageListWhat single-page data does the tag retrieve by default on a website?

The answer is: when you use the templatepageListwhen you tag the document, ifNo additional parameters are specified(exceptsiteIdwhich usually defaults to the current site, and needs to be specially paid attention to in a multi-site environment), it will obtain and present everything without reservationall the single page data that has been published on the current website.

This means that, whether it is the "About Us" you created under "Page Resources" and "Page Management" in the background, or the "Service Agreement", or even the "Disclaimer", as long as they are single-page pages that have been published,pageListLabels will take them all into their data collection.It does not preset any filtering conditions, but instead packages all the basic information of single pages to provide to you, allowing template developers to have the greatest freedom to decide how to display, filter, or sort this data.

Specific to each single page,pageListLabels will provide the following key information by default:

  • Single page ID (Id): Unique identifier for each single page.
  • Single page title (Title): For example, 'About Us' or 'Contact Information'.
  • Single page link (Link): Visit the URL of this single page.
  • Single page description (Description): Brief overview of the content of this single page.
  • Single page content (Content): Full HTML or Markdown content on a single page (depending on backend settings whether it is rendered as HTML).
  • Single page thumbnail full image (Logo)If the main image is uploaded on a single page, the address of the large image will be provided here.
  • Single page thumbnail (Thumb)If the thumbnail is uploaded on a single page, the address of the thumbnail will be provided here.

These fields constitute the basic profile of each single page, ensuring that you can flexibly call and display this information in the template as needed.

Practical Application: Mastering Single Page Data Flexibly

UnderstoodpageListAfter the default behavior, we can use it flexibly in the template.

The most common usage is to iterate over all single pages, for example, you might want to display some important single page links in the footer area of the website:

<ul>
{% pageList pages %}
    {% for item in pages %}
    <li>
        <a href="{{ item.Link }}">{{item.Title}}</a>
    </li>
    {% endfor %}
{% endpageList %}
</ul>

due topageListDefault to retrieve all pages, if you want to exclude certain pages from displaying (for example, you do not want the "Privacy Policy" to appear in the footer), you need toforWithin the loop, perform conditional judgment. This "get all first, then filter as needed" pattern gives the template great flexibility, avoiding the complexity of overloaded tag parameters:

<ul>
{% pageList pages %}
    {% for item in pages %}
    {# 假设隐私政策的ID是5,或者标题是“隐私政策” #}
    {% if item.Id != 5 and item.Title != "隐私政策" %}
    <li>
        <a href="{{ item.Link }}">{{item.Title}}</a>
    </li>
    {% endif %}
    {% endfor %}
{% endpageList %}
</ul>

In this way, we can easily adjust the display strategy of a single page dynamically according to the business logic without modifying the parameters of the tag itself.

Summary

AnQiCMS'pageListThe tag provides a unified entry point for all single-page data on the website with its simple and powerful default behavior.It does not preset complex filtering logic, but instead gives full control to the template developer, through conditional judgments and loop controls within the template, achieving fine-grained management and personalized display of single-page data.This design concept is a reflection of the balance between content operation efficiency and flexibility in AnQiCMS.


Frequently Asked Questions (FAQ)

Q1:pageListDoes the tag support pagination functionality?

A1: According to the design of AnQiCMS,pageListTags are mainly used to obtain the list data of a single page, itdoes not provide pagination parameters directly(such aslimitortype="page")。A single page usually contains a limited number, such as 'About Us', 'Contact Us', etc., so it is designed by default to retrieve all data at once.If you have a few single-page pages that need to be displayed in batches, you can use them inside the templateforrepeatedlysliceFiltering and other methods can be used for limited simulation, but when facing a large number of single-page applications that require complex pagination, it may be necessary to consider adjusting the content model or carrying out secondary development.

Q2: How to retrieve only specific single pages instead of all pages?

A2:pageListThe label itself does not have a direct ID or title filter parameter to limit the number of items obtained.It defaults to fetching all published single-page data. To display only specific pages, you need to do so after you have retrieved all the page data, inforUse conditional judgment statements inside the loop (such as{% if item.Id == X or item.Title == "Y" %}) Selectively display the pages you need. For example, if you want to display pages with IDs 1 and 3, you can write it like this:

{% pageList pages %}
    {% for item in pages %}
        {% if item.Id == 1 or item.Id == 3 %}
            <li><a href="{{ item.Link }}">{{item.Title}}</a></li>
        {% endif %}
    {% endfor %}
{% endpageList %}

Q3: If I want to display a single-page list in the website navigation but do not want to show the 'Site Map' page, what should I do?

A3: This is very simple, just need to traversepageListreturnedpagesUtilize dataifUse logical judgment to exclude the 'site map' page. You can exclude it by the page title or ID. For example:

<nav>
    <ul>
    {% pageList pages %}
        {% for item in pages %}
            {# 假设“站点地图”的标题是“站点地图”,或者知道其ID #}
            {% if item.Title != "站点地图" %}
                <li><a href="{{ item.Link }}">{{item.Title}}</a></li>
            {% endif %}
        {% endfor %}
    {% endpageList %}
    </ul>
</nav>

This approach gives you great flexibility at the front-end template level, allowing you to easily implement content filtering without modifying the backend logic or tag definitions.