As an experienced website operation expert, I know the efficiency and flexibility of AnQi CMS in content management. Today, let's delve into one of the important members of the AnQiCMS template tag system -pageListTags, especially how it will fetch which single-page data from the website by default. Understanding this is crucial for our efficient content presentation and template design.


Deep Analysis of Security CMSpageListLabel: What single-page data is fetched by default?

In the world of AnQiCMS, the single-page (Page) plays a role that is relatively static, independent in content, but indispensable in the website, such as 'About Us', 'Contact Us', 'Privacy Policy', and so on.They are not updated as frequently as articles or products, but they carry the basic information of the website and the brand image.pageListLabel.

KnowpageListThe core function of the tag

pageListThe label is called as such, and its main responsibility is to obtain the single-page list in the website.Its design philosophy embodies the simplicity and efficiency of AnQiCMS.{% pageList pages %}...{% endpageList %}Use this structure, wherepagesis the variable name defined for the set of single-page data obtained.

Core Revelation:pageListThe default behavior

Now, let's get to the heart of the matter:pageListBy default, what single-page data will the tags retrieve from the website?

The answer is: when you usepageListthe tag in the template, ifDo not specify any additional parameters(Except)siteId, it usually points to the current site by default, and it needs to be specially paid attention to in a multi-site environment), it will retrieve and present without reservationAll the single-page data published on the current website.

This means, whether you create 'About Us' under 'Page Resources' and 'Page Management' in the background, or 'Service Agreement', or even 'Disclaimer', as long as they are single pages in the published state,pageListAll tags will include them in their data collection.It does not preset any filtering conditions, but packages all the basic information of a single page and provides it to you, allowing template developers to have the greatest freedom to decide how to display, filter, or sort these data.

Specific to each single page,pageListTags will provide the following key information:

  • Single page ID (Id): The unique identifier for each single page.
  • Single page title (Title):For example, "About Us" or "Contact Information".
  • Single page link (Link):The URL address of the single page.
  • Single page description (Description):A brief overview of the single page content.
  • Single page content (Content): Full HTML or Markdown content of a single page (determined by backend settings whether to render as HTML).
  • Single page thumbnail large image (Logo):If the main image is uploaded on a single page, the large image address will be provided here.
  • Single page thumbnail (Thumb):If a thumbnail is uploaded on a single page, the thumbnail address 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 being displayed (for example, not displaying the "Privacy Policy" in the footer), you need toforPerforming conditional judgment inside the loop. This "first get all, then filter as needed" pattern gives the template great flexibility and avoids 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>

We can easily adjust the display strategy of a single page dynamically according to the business logic without modifying the parameters of the label itself.

Summary

AnQiCMSpageListThe label provides a unified entry for all single-page data on the website with its simple and powerful default behavior.It does not preset complex filtering logic, but leaves the choice entirely to the template developer, who can achieve fine-grained management and personalized display of single-page data through conditional judgments and loop controls within the template.This design concept is the embodiment of AnQiCMS achieving a balance between content operation efficiency and flexibility.


Common Questions (FAQ)

Q1:pageListDoes the label support pagination function?

A1: According to AnQiCMS design,pageListTags are mainly used to obtain list data on a single page, itdoes not provide pagination parameters directly(such aslimitortype="page")。 EnglishSingle-page applications usually have a limited number, such as "About UsforLoopingsliceFiltering and other methods are used for limited simulation, but if faced with a large number of single-page applications that require complex pagination, it may be necessary to consider adjusting the content model or conducting secondary development.

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

A2:pageListThe label itself does not have direct ID or title filtering parameters to limit the number of items obtained.It defaults to fetching all published single-page data.forUse conditional statements inside the loop (such as){% if item.Id == X or item.Title == "Y" %}Choose selectively which pages to display. For example, if you only want to show 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: How can I display a single-page list in the website navigation without showing the 'Site Map' page?

A3: This is very simple, just need to traversepageListreturnedpagesWhen data is processed, utilizingifLogical judgment to exclude the "sitemaps" page. You can exclude it by the title or ID of the page. 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.