How does the `pageList` tag display all the titles and links of the individual pages of the website?

Calendar 👁️ 70

In the Aiqi CMS, make use ofpageListThe tag displays the titles and links of all single pages, which is a very common and practical need in website layout and navigation settings. Whether it is used for website footer navigation, sidebar link lists, or building a simple HTML site map, pageListTags can help us efficiently achieve these functions.

Understand the single-page in Anqi CMS

First, let's briefly review the 'single page' in AnQi CMS.In the Anqi CMS backend management, there is a special "Page Resources" module, which includes the "Page Management" function.This is where you create and manage independent pages such as 'About Us', 'Contact Us', and 'Privacy Policy'.These pages usually have relatively fixed content, do not belong to articles or product models, and each has an independent title, content, link, and can even be configured with thumbnails and SEO information.

pageListThe core role of tags

Anqi CMS provides a very convenient template tag——pageListIt is specifically used to obtain information about all single pages on a website. Its design philosophy is to allow us to easily traverse these independent pages and extract the data we need, such as the title and links of the pages.

UsepageListThe basic structure of tags is very intuitive, it needs a start tag{% pageList %}And an ending tag.{% endpageList %}We can use between these tagsforloop to process each single page one by one.

Basic usage: Display the titles and links of all single pages

To display the titles and links of all single pages on a website, we need topageListwith the tag andforCombine in a loop.pageList pagesDeclared a namedpagesThe variable, it will contain all the collections of single pages. Inforthe loop,itemrepresents each single page object in the collection.

EachitemAn object contains a series of page-related properties, the most commonly used and most suitable for our needs isitem.Title(Page title) anditem.Link(Page link).

Here is a simple template code example that will display all single pages in an unordered list (<ul>) in the form, each list item contains the title of the page and a link to the page:

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

This code will traverse all single pages created in the "Page Management" section of the Anqin CMS backend and generate a list item for each page<li>which includes a hyperlink<a>The link text is the title of the page, and the link's target address is the actual URL of the page.

Deep understandingpageListParameters and fields of the tag

pageListTags do not usually require additional parameters to retrieve all single-page information. However, for multi-site users, one cansiteIdParameters to specify the single-page list of a specific site. For example:{% pageList pages with siteId="1" %}.

exceptitem.Titleanditem.LinkIn addition, each single pageitemThe object also provides other useful fields that can be displayed as needed:

  • item.Id: The unique ID of a single page, often used for debugging or combined with conditional judgment.
  • item.Description: A brief description of a single page, which can be used as supplementary information below the link.
  • item.Content: The complete content of a single page (usually not displayed directly on the list page unless there is a special need).
  • item.Logo: The main image or large image URL of a single page.
  • item.Thumb: The thumbnail URL of a single page, if the page is configured with a thumbnail.

If you want to display this additional information in the list, you can directly useforUsing a loop{{ item.Description }}/{{ item.Thumb }}to call. For example:

<ul class="page-cards">
{% pageList pages %}
    {% for item in pages %}
    <li>
        <a href="{{ item.Link }}">
            {% if item.Thumb %}<img src="{{ item.Thumb }}" alt="{{ item.Title }}"/>{% endif %}
            <h3>{{ item.Title }}</h3>
        </a>
        {% if item.Description %}<p>{{ item.Description }}</p>{% endif %}
    </li>
    {% endfor %}
{% endpageList %}
</ul>

A more flexible display method: exclude specific pages

In some cases, you may not want all the single pages of the website to be displayed in a list.For example, you created a "Privacy Policy" page, but you only want to display the link in the footer and not in the main navigation bar.At this time, one canforAdd conditional judgment within the loop to filter specific pages

We can make use ofitem.IdOr (the unique ID of the page)item.Title(Page Title) to filter. Using ID is usually more accurate and robust because the title may change.

<ul class="main-navigation">
{% pageList pages %}
    {% for item in pages %}
        {# 假设ID为5的页面是“隐私政策”,我们不希望它出现在这个导航中 #}
        {% if item.Id != 5 %}
        <li>
            <a href="{{ item.Link }}">{{ item.Title }}</a>
        </li>
        {% endif %}
    {% endfor %}
{% endpageList %}
</ul>

By such condition judgment, you can flexibly control which single pages should be displayed at the current location.

Application scenario example

pageListThe flexibility of the tag makes it suitable for a variety of website structures and layouts:

  • Website footer navigation:Quickly list links to pages such as "About Us", "Contact Information", "Terms of Service", etc.
  • Sidebar menu:List single pages related to the current content as auxiliary navigation.
  • Supplement to the in-site search results:In search results, it is also desirable to display related single-page pages.
  • HTML site map: Create a concise list to help users and search engines quickly understand the website structure.

Points to note

While usingpageListWhen labeling, there are several small details to pay attention to in order to ensure the correctness of the template code and the normal operation of the website:

  • Label case sensitivity:The template tags of AnQi CMS are case-sensitive. Please make surepageList/pages/item.Title/item.Linkare written strictly according to the camel case naming convention in the document.
  • Location of the template file: pageListthe tags are usually in/templateUnder the directory.htmlused in template files.
  • Data source: pageListThe one-page that is published and visible in the background "Page Management". If a page is not published or set to not display, it will not appear inpageListthe results.

Summary

In summary, it is about AnQi CMS'spageListLabels provide a直观 and efficient way to manage and

Related articles

How to retrieve and display detailed information such as description, Logo, etc. for a specific category using the `categoryDetail` tag?

In AnQiCMS template development, obtaining and displaying detailed category information is a key step in building rich and user-friendly pages.The `categoryDetail` tag was created for this purpose, it can help you easily retrieve the description, Logo, custom fields, and other detailed content of a specific category at any location on the page.### `categoryDetail` tag's core function The main function of the `categoryDetail` tag is to obtain detailed data of a single category

2025-11-07

How does the AnQiCMS `categoryList` tag display hierarchical category structures and show category information?

In AnQi CMS, website categories are the foundation for organizing content. Whether it's articles, products, or other custom models, a clear category structure can greatly enhance user experience and the website's SEO effectiveness.The Anqi CMS provides a powerful `categoryList` tag, allowing us to flexibly display single or multi-level classification structures and easily obtain detailed information about each classification.### Master the basic usage of the `categoryList` tag To display the category list, we first need to use the `categoryList` tag

2025-11-07

How does the `relatedArchive` tag display a list of related articles based on document relevance?

In the daily operation of a website, how to make users naturally discover more interesting content after reading an article is the key to improving user experience, extending the time spent on the website, and even optimizing SEO effects.AnQi CMS understands this and provides powerful template tag features, where the `relatedArchive` tag is exactly used to intelligently display related article lists.## `relatedArchive` label

2025-11-07

How to display the link to the previous and next documents on the AnQiCMS document detail page?

In the ocean of website content, users often hope to browse related information smoothly, not wanting to return to the list to find the next article after reading a wonderful article.This not only affects user experience, but also benefits the internal link structure of the website and search engine optimization (SEO) a lot.AnQiCMS has fully considered this point, providing a convenient and quick navigation function for the content detail page, allowing users to easily navigate between different documents.The AnQiCMS template system is very flexible, it adopts the syntax of the Django template engine

2025-11-07

How does the `pageDetail` tag display the detailed content of a single page, such as the 'About Us' page?

In Anqi CMS, single pages (such as "About UsTo present the detailed content of these single pages on the website frontend, we will use a very core and practical template tag——`pageDetail`.This tag helps us accurately extract and display various information on a specified single page, ensuring the flexibility and accuracy of content presentation.

2025-11-07

How does the AnQiCMS `tagList` tag display all associated tags of the document?

## Easily display document-related tags: In-depth analysis of AnQiCMS's `tagList` tag In content management, tags (Tag) play a crucial role.They can not only help us better organize content and improve the internal link structure of the website, but also play a huge role in search engine optimization (SEO), making it easier for users and search engines to find relevant information.AnQiCMS has fully considered this point and provided a flexible and powerful tag management system.Among, `tagList`

2025-11-07

How does the `tagDetail` tag display the name, description, and other properties of a single tag?

In website content management, tags (Tag) play a multiple role in connecting content, optimizing user experience, and improving search engine visibility.A well-managed tag system not only helps visitors quickly locate the information they are interested in, but also conveys the structured information of the website content to search engines, thereby effectively improving SEO.AnQiCMS (AnQiCMS) fully understands the importance of tags and therefore provides a powerful and easy-to-use `tagDetail` tag, allowing you to flexibly obtain and display detailed information about individual tags.

2025-11-07

How to get and display the associated document list based on a specific tag of `tagDataList`?

In AnQi CMS, tags are not just an auxiliary tool for content management, but also a powerful tool for connecting different thematic content, enhancing the internal link structure of the website, and optimizing the user experience.When you want to display a list of all documents related to a specific tag on a specific page of the website, such as a special page, a tag cloud page, or the sidebar of a specific article, the `tagDataList` tag is your best choice.

2025-11-07