How to list and display the titles and links of all single pages?

Calendar 👁️ 79

AnQi CMS provides a intuitive and powerful content management capability, among which the single-page feature is an ideal choice for building independent pages such as 'About Us', 'Contact Information', or 'Privacy Policy'.When you need to display the titles and links of these single pages collectively at a certain location on the website, such as the footer navigation, sidebar, or a special page index, AnQiCMS template tags can help you easily achieve this.

In AnQiCMS backend, the single page content is created and maintained under "Page Resources" -> "Page Management".You can easily add independent pages like "About Us" and "Contact Information" to your website, and set their titles, content, and URLs in detail.Once these single pages are created, we can use template tags to display them on the frontend page.

UsepageListTag list all single pages

You need to use AnQiCMS built-in to list all single page titles and links in the front-end templatepageListTemplate tag. This tag is specifically designed to retrieve and traverse all single-page data of a website.

pageListThe basic usage of the tag is very simple. It is usually used with other control flow tags such asforCombine the loop to traverse the information of each single page.

Firstly, you need to find the appropriate position in the template file where you want to display the list of single pages. This may be on the website'sbash.html(If you want it to be displayed on all pages, such as the footer),index.html(Home page), or any other specific page template.)

Next, you can use it like this:pageListTags:

<div class="footer-links">
    <h4>快速链接</h4>
    <ul>
    {% pageList pages %}
        {% for item in pages %}
        <li>
            <a href="{{ item.Link }}">{{ item.Title }}</a>
        </li>
        {% endfor %}
    {% endpageList %}
    </ul>
</div>

Let's break down this code:

  • {% pageList pages %}This is the core tag, it retrieves all the single-page data published on the website and assigns it to a variable namedpages.
  • {% for item in pages %}This is a loop statement, it traversespagesEach single page in the variable. In each iteration, the data of the current page will be temporarily stored initemthe variable.
  • {{ item.Link }}This will output the complete URL link of the current page.
  • {{ item.Title }}This will output the title of the current single page.
  • {% endfor %}and{% endpageList %}These are the corresponding end tags, marking the loop andpageListScope of the tag.

By this code, you can generate an unordered list containing all single page titles and corresponding links. You can use them according to your website design, with<div>/<span>Or use other HTML tags to wrap these links and apply the corresponding CSS styles to keep them consistent with the overall style of the website.

Flexible filtering and display

AnQiCMS'pageListLabels also allow you to make some adjustments based on specific needs.

Exclude certain pages:Sometimes you may not want all single pages to be displayed, such as some internal test pages or pages that are not displayed in the public navigation. You canforUsing a loopifConditional judgments to exclude them. Suppose you want to exclude the single page with ID 1, or the single page with the title "Test Page":

<div class="footer-links">
    <h4>常用页面</h4>
    <ul>
    {% pageList pages %}
        {% for item in pages %}
        {# 排除ID为1的页面,或者标题为“测试页面”的页面 #}
        {% if item.Id != 1 and item.Title != "测试页面" %}
        <li>
            <a href="{{ item.Link }}">{{ item.Title }}</a>
        </li>
        {% endif %}
        {% endfor %}
    {% endpageList %}
    </ul>
</div>

here,item.Idanditem.TitleUsed to retrieve the ID and title of a single page, you can flexibly adjust the judgment conditions according to your actual needs.

Display more page information:In addition to the title and link, each single page also contains other useful information, such as:

  • item.Description: Brief introduction of the single page.
  • item.Thumb: Thumbnail address of a single page.
  • item.Content: Detailed content of the single page (usually not displayed in the list, but available when needed).

If you wish to display this additional information in the list, you can refer to{{ item.Title }}and{{ item.Link }}to call the usage. For example, to display thumbnails and summaries:

<div class="page-highlights">
    {% pageList pages %}
        {% for item in pages %}
        {% if item.Thumb %} {# 检查是否有缩略图 #}
        <div class="page-card">
            <a href="{{ item.Link }}">
                <img src="{{ item.Thumb }}" alt="{{ item.Title }}">
                <h3>{{ item.Title }}</h3>
                <p>{{ item.Description }}</p>
            </a>
        </div>
        {% endif %}
        {% endfor %}
    {% endpageList %}
</div>

By using these flexible tag combinations, you can easily display all or specific single-page content in the way you want in AnQiCMS, thereby enhancing the usability and user experience of the website.


Frequently Asked Questions (FAQ)

1. Where can I create and manage the single page of AnQi CMS?You can find the 'Page Management' option under the 'Page Resources' menu in the AnQiCMS backend.Here, you can create, edit, delete, and manage all single-page content, including their titles, content, URL aliases, SEO information, etc.

2. How to control the display order of single pages?When editing any single page in the "Page Management" section of the background, you will see a "Display Order" field.This field allows you to set a number, the smaller the number, the earlier the single page will be displayed in the list when called.You can adjust these numbers according to your needs to control the page sorting.

3. Besides the title and link,pageListWhat information can the label display on a single page?exceptitem.Title(Title) anditem.Link(Link), you can also access it throughitemVariable access and display other properties of a single page, such as:

  • item.Id: Unique ID of the single page.
  • item.Description: Brief description of a single page.
  • item.Content: Detailed content of a single page (note that it may need to be truncated or avoided when displayed in a list).
  • item.Logo: Address of the thumbnail and large image set for a single page.
  • item.Thumb: Thumbnail address of the single page setting. You can optionally add this information to your template as needed.

Related articles

How to retrieve and display detailed information for a specific category, such as the category logo and introduction?

In website operation, a clear and informative classification display is the key to attracting visitors, improving user experience, and optimizing search engine rankings.AnQiCMS provides a user-friendly and powerful template tag system that allows you to flexibly obtain and display detailed information of various categories on your website, such as category logo and introduction, thereby creating a more attractive content layout. ### Understand Category Information Management and Configuration Category information management is very convenient in the Anqi CMS backend.When you enter the 'Content Management' under 'Document Category' to add or edit

2025-11-08

How to display category lists on the homepage or category pages?

In Anqi CMS, managing and displaying the category list is the core of website content organization.It is crucial to clearly display the classification structure for optimizing user navigation experience or improving search engine crawling efficiency.The Anqi CMS provides concise and powerful template tags, allowing you to easily display your content categories on the homepage, category pages, or any place you need.### Understanding Core: `categoryList` Tag In the AnQiCMS template system, the main tag used to retrieve the category list is `categoryList`

2025-11-08

How can the breadcrumb navigation of the current position be displayed on the page?

In website navigation, Breadcrumb navigation is a very practical auxiliary tool.It clearly shows the user's current position on the website, provides a convenient return path, thereby significantly improving the user experience, and also has a positive effect on search engine optimization (SEO), helping search engines understand the structural hierarchy of the website.AnQiCMS has fully considered this point and provided a simple and powerful way to display breadcrumb navigation on the page.With built-in template tags, even without complex programming knowledge, this feature can be easily implemented.###

2025-11-08

How to build a multi-level navigation menu in AnQiCMS to optimize the display of the website structure?

The website's navigation system, like a city map, guides visitors to explore every corner of your website. A clear, intuitive multi-level navigation not only greatly enhances the user experience but is also an indispensable part of Search Engine Optimization (SEO), helping search engines better understand the structure of the website and thereby improve content inclusion and ranking.In AnQiCMS, building a set of efficient and beautiful multi-level navigation menus is actually simpler than you imagine. It provides flexible backend configuration and powerful template tags, allowing you to easily implement it.Build Navigation Basics

2025-11-08

How to retrieve and display the complete content and images of a specific single page?

Use AnQiCMS to manage and display website content, especially when dealing with independent and rich single-page content such as "About Us" and "Contact Information", its flexibility and powerful functions are particularly prominent.We often need to present the text, images, and even image sets of these pages in their entirety on the website, and AnQiCMS provides a very intuitive way to achieve this. Let's explore together how to retrieve and display the complete content and images of a specific single page in AnQiCMS, making your website content more vivid and diverse.## Content Creation

2025-11-08

How to call and display a document list in a template, and perform sorting and filtering?

Manage and display website content in AnQi CMS, especially document lists, is a very common need in daily operation.Strong and flexible template tags provided by AnQi CMS, allowing us to easily call and display this content on the website front-end, and sort and filter as needed.This article will deeply explore how to use the template function of Anqi CMS to achieve these goals and make your website content display more attractive.### Core Function: `archiveList` tag - Display the basic document content To display the document list

2025-11-08

How to display the link to the previous and next article on the article detail page?

It is an important link in the article detail page of AnQi CMS to display "Previous" and "Next" navigation links, which helps improve the user experience and the internal link structure of the website.This not only guides readers to continue browsing related content and extend their stay time, but also helps search engines better understand the relevance between website content, which has a positive effect on SEO optimization.AnQi CMS provides a user-friendly and powerful template tag system

2025-11-08

How to get and display a list of recommended articles related to the current article?

In website operation, when we have worked hard to create an article, we naturally hope that it can be seen by more readers and guide them to explore more exciting content.On the bottom or sidebar of the article detail page, cleverly display recommended content related to the current article, which can not only significantly improve the depth and dwell time of users' reading, but also bring many benefits to search engine optimization (SEO).AnQiCMS (AnQiCMS) fully understands this need and provides extremely convenient and powerful tags to help us easily achieve this goal.### Cleverly Utilize `archiveList`

2025-11-08