How are the `pageList` and `pageDetail` tags used to display single-page content such as 'About Us'?

Calendar 👁️ 60

In website operation, content like "About Us", "Contact Information", or "Service Introduction" usually exists as independent pages, and we call it "single page".They are not updated as frequently as blog articles, but they are essential core information of the website.Aanqi CMS providedpageListandpageDetailThese tags allow you to manage and display these single-page contents very flexibly and efficiently.

The "single-page" content in the background management

Before delving into the usage of tags, let's first take a look at how to create and manage single pages in the Anqi CMS backend.After logging in, find "Page Management" under the "Page Resources" module.Here, you can create a new single-page and fill in its core information:

  • Page name:This is the title that the user sees on the website's front end.
  • Page content:This is the main content of a single page, which can use a rich text editor, and even support Markdown syntax for writing.If the content of your post is in Markdown format, the system can also convert it to HTML during rendering.
  • Custom URL:In order to optimize for SEO and user-friendliness, you can set a concise and meaningful URL alias for each single page, such as "about-us" or "contact."}
  • SEO title, keywords, description:These are important fields for search engine optimization that can help your single page get a better display in search results.
  • Single page template: This is a very practical feature. In addition to using the default single-page template (such aspage/detail.htmlIn addition, you can specify a separate template file for a specific single page to achieve fully customized design and layout.For example, you can design a unique visual style for the "About Us" page, while other single pages maintain a common style.
  • Thumbnail and Banner image:If your single page needs to have special pictures or sliders, you can also upload and configure them here.

These backend settings are the foundation for the front-end tags to call data.

Display a single page content:pageDetailTag

When you want to display detailed content of a specific single page at a certain location on the website, such as a dedicated "About Us" page or a specific block on the homepage,pageDetailthe label comes into play.

In most cases, when you visit a single page (such as throughyourdomain.com/about-us.html), the Anqi CMS system will automatically identify the current page and provide you with all the detailed data for that page. This means that inpage/detail.htmlor you can directly use in your custom single-page template{{page.Title}}/{{page.Content}}to get the information of the current page without specifying an ID.

For example, in a standard "About Us" page template (page/about-us.html) you can display content in this way:

<article>
    <h1>{% pageDetail with name="Title" %}</h1>
    <div class="page-content">
        {%- pageDetail pageContent with name="Content" render=true %}
        {{pageContent|safe}}
    </div>
    {%- tdk canonical with name="CanonicalUrl" %}
    {%- if canonical %}
    <link rel="canonical" href="{{canonical}}" />
    {%- endif %}
</article>

This code first retrieves the title of the current single page, then the core content. It should be noted that,ContentFields usually contain HTML or Markdown, in order for the browser to parse and display styles correctly, we will userender=trueparameters (if the content is Markdown) and|safeThe filter tells the system that this content is safe HTML and does not require additional escaping. Finally, if the background has set a specification link, it will also pass through.tdkThe tag outputs it, which is beneficial for SEO.

If you need to call the single-page content with a specific ID or URL alias in other places, such as in a module on the homepage, you can do it like thispageDetailTags:

{# 假设您想在首页展示 ID 为 10 的“公司简介”单页面内容 #}
<section class="company-intro">
    <h2>{% pageDetail with name="Title" id="10" %}</h2>
    <p>{% pageDetail with name="Description" id="10" %}</p>
    <a href="{% pageDetail with name="Link" id="10" %}" class="read-more">了解更多</a>
</section>

{# 或者通过自定义URL别名来获取 #}
<section class="contact-info">
    <h3>联系我们</h3>
    {% pageDetail contactPage with token="contact-us" %}
    <p>{{contactPage.Content|safe}}</p>
    <p>电话:{% contact with name="Cellphone" %}</p>
</section>

Byid="10"ortoken="contact-us"parameter,pageDetailThe tag can accurately retrieve data from a specified single page, allowing you to flexibly refer to it anywhere on the website.

List multiple single-page content:pageListTag

Sometimes, you may need to list multiple single pages in one place, such as displaying links to 'About Us', 'Terms of Service', and 'Privacy Policy' in the footer navigation of a website. At this point,pageListThis tag is very suitable. It will return all the single-page lists created, and you can iterate over and display these pages.

pageListThe label is very intuitive to use, it does not require any additional parameters, just a variable name to carry the returned single-page collection:

<nav class="footer-nav">
    <h3>友情链接</h3>
    <ul>
    {% 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>
</nav>

In this example, we usepagesVariables to receivepageListReturn the single-page array and then throughforLoop through each oneitem. Inside the loop,item.LinkIt will output the link of the page,item.TitleThen output the page title. We also added a conditional judgment.{% if item.Id != 5 %}Demonstrate how to flexibly exclude certain specific pages from being listed to ensure that only the content you want is displayed.

Flexible application with tips

  1. Template customization:As mentioned earlier, creating a custom template for key single-page (such as "About Us") can greatly enhance the uniqueness and user experience of the page. In the background page management, directly fill in the path of your custom template file (such aspage/about.html)pageDetailThe tag will be automatically applied.
  2. SEO-friendly URL:Make full use of the "Custom URL" feature on your single-page site to set up meaningful, SEO-compliant short links, for example, setting the/about/Instead/page/1.html.
  3. Content security processing:When displaying single-page content, be sure to use|safefilters. If your content contains Markdown, don't forget topageDetailthe tag withrender=trueParameters, let the system complete the conversion for you.
  4. Footer navigation and sidebar: pageListIt is very suitable for building website footer navigation, sidebar links, or "site map" functions, and can quickly generate these link sets.

Of Security CMSpageListandpageDetailThe label aims to provide both powerful and concise single-page content management and display capabilities.Whether it is to accurately display the details of a page or to flexibly build page list navigation, they can all help you easily achieve the layout of the website's content.


Frequently Asked Questions (FAQ)

1. How can I make the "About Us" page have a unique style instead of using the common style of all single pages?

You can edit the 'About Us' single page in the 'Page Management' section of the Anqi CMS backend. At the bottom of the edit page, there is an option for the 'Single Page Template', where you can enter a custom template filename, for examplepage/about.html. Then, create this file in your theme directory and write HTML and CSS according to your design requirements, so that the system will load this custom template separately for the "About Us" page.

2. I have created multiple single pages, but I only want to display a few in the footer navigation and exclude the "Disclaimer" page. How can I do this?

You can usepageListLabel to iterate over all single pages and use them in a loop{% if %}Condition judgment to exclude pages that do not need to be displayed. For example, if the ID of the "Disclaimer" page is7You can write it like this in the template:

{% pageList pages %}
    {% for item in pages %}
        {% if item.Id != 7 %} {# 排除ID为7的页面 #}
            <li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
        {% endif %}
    {% endfor %}
{% endpageList %}

You can flexibly control which pages are displayed in the list in this way.

3. If my single-page content is written in Markdown,pageDetailcan the tags be displayed correctly?

Yes, the Anqi CMS'spageDetailThe tag supports rendering Markdown content. When you call `Content

Related articles

How to retrieve and display the name, description, and thumbnail of a specific category?

In website operations, clearly and effectively displaying classification information is crucial for user experience and search engine optimization.A specific category name can help users quickly understand the content theme, a concise description can provide more background information, and a direct thumbnail can attract users to click.AnQiCMS (AnQiCMS) provides a powerful and flexible template tag feature, allowing you to easily obtain and present these key classification information, whether it is to build a navigation menu, design a category list page, or optimize search engine results.###

2025-11-08

How to use the `categoryList` tag to display the list of articles/products categories on the homepage or sidebar?

When building and optimizing a website, a clear navigation structure is crucial for user experience and search engine optimization.AnQiCMS (AnQiCMS) provides us with powerful template tags, among which the `categoryList` tag is a core tool used to flexibly display article or product category lists on the homepage or sidebar of the website.With it, we can easily organize the content of the website neatly, allowing visitors to find the information they are interested in at a glance.Why is the category list so important? Imagine when visitors come to a rich content website

2025-11-08

How to automatically generate breadcrumb navigation using the `breadcrumb` tag and customize the display text on the homepage?

The user experience of a website largely depends on the convenience and clarity of navigation.When the visitor delves into the website content, a friendly 'Breadcrumb Navigation' can clearly indicate the current position and provide a quick path to return to the upper page.AnQiCMS is well-versed in this, providing a powerful and easy-to-use `breadcrumb` tag that allows website administrators to automatically generate paths without complex coding, and even to flexibly customize the display text on the homepage.

2025-11-08

How to use the `navList` tag to build a website navigation menu with secondary dropdown?

Build a clear and easy-to-use website navigation menu is an important link to improve user experience and website professionalism.In AnQi CMS, we can take advantage of the powerful `navList` tag to easily implement a navigation menu with secondary dropdown support, making the website content well-structured and convenient for visitors to browse.Next, we will explore how to use the `navList` tag, from backend configuration to frontend template rendering, step by step to create a complete second-level dropdown navigation.

2025-11-08

How does the `archiveList` tag display the article list based on categories, recommended attributes, or custom sorting?

In the Anqi CMS template system, the `archiveList` tag is the core tool for building dynamic content lists.Whether it is a blog article list, product display page, or news information module, `archiveList` can help you accurately filter, sort, and present content according to your diverse needs, bringing vitality to your website content area.

2025-11-08

How to display article title, content, images, etc. on the document detail page using the `archiveDetail` tag?

Manage website content in Anqi CMS, the document detail page is undoubtedly the core position for users to obtain information.How to present each carefully written article, its title, content, images, and various additional information accurately and vividly to the user, this requires the clever use of our `archiveDetail` tag.This tag is specifically designed to display the details of a single document, and its flexible use will help you easily build a feature-rich and smooth experience detail page.

2025-11-08

How to implement the previous/next document function using `prevArchive` and `nextArchive` tags?

When you operate a website, providing a smooth reading experience for users is one of the key factors in enhancing website stickiness.When a user finishes reading a document, if they can easily jump to the previous or next related article, it will undoubtedly greatly increase their stay time on your website.AnQiCMS (AnQiCMS) understands this and provides very intuitive and powerful `prevArchive` and `nextArchive` tags to help you easily implement this feature.

2025-11-08

How to use the `archiveList` tag's `type="related"` feature to display related article recommendations?

On your website, when visitors finish reading an article, if they can see related content in time, it not only can significantly improve the user experience, reduce the bounce rate, but also can effectively increase the page views and stay time on the website.AnQi CMS provides a very convenient tag: `archiveList`,配合其`type="related"` attribute, it can easily realize this function.###

2025-11-08