How to get the list of all single pages or the detailed content of a specific single page in AnQiCMS template?

Calendar 78

As an experienced CMS website operation person, I am well aware of the importance of high-quality, well-structured content for website user experience and search engine optimization.The single page is the core of website basic information display, such as 'About Us', 'Contact Information', and 'Terms of Service' and so on.In AnQiCMS, through the powerful template tag system, we can flexibly obtain and display the content of these single pages.

I will elaborate in detail on how to obtain the list of all single pages and the detailed content of a specific single page in the AnQiCMS template.

Obtain the list of all single pages

In AnQiCMS template, to display the website's list of all single pages, we can usepageListThe tag can help us easily traverse and output all the single pages created, which is very useful when making a sitemap, footer navigation, or specific information module.

pageListThe label usage is concise and clear, it does not require additional parameters, and it will default to retrieving all single-page data under the current site. You can define the data retrieved to a variable and then throughforLoop through this variable, output the details of each single page one by one. For example, you can define the data aspages:

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

In the above code,itemThe variable represents each single page object in the loop, you can access itsId(Page ID),Title(Page Title),Link(Page Link),Description(Page Description),Content(Page Content),Logo(Single page thumbnail large image) andThumb(Single page thumbnail) etc fields.

If you need to exclude certain pages based on specific conditions, althoughpageListThe tag itself does not have direct filtering parameters, but you canforcombine within the loopifLogical judgment for filtering. For example, to exclude a single page with ID 1:

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

In this way, you can flexibly control which single-page applications need to be displayed in the list. If your website is a multi-site architecture and you want to get a list of single-page applications under a specific site, you canpageListthe tag withsiteIdto specify the site ID.

Retrieve detailed content of a specific single page

When you need to display the complete content of a specific single page, such as the detailed introduction of the "About Us" page,pageDetailThe tag is your **choice. This tag allows you to accurately retrieve all field information for a single page based on the page ID or URL alias.

pageDetailThe basic usage of tags is, you can specify the field name you want to retrieve, or you can get the entire single page object into a variable. For example, to retrieve the title of the current visited single page:

<h1>{% pageDetail with name="Title" %}</h1>

To retrieve the content of a single page with ID 1:

<div>
    {% pageDetail pageContent with name="Content" id="1" %}
    {{pageContent|safe}}
</div>

It is worth noting that,Contentfields usually need to be accompanied by|safeA filter to ensure that HTML content is not escaped. Additionally, if the Markdown editor is enabled on the backend,ContentThe field will automatically convert Markdown to HTML. If you need to manually control the conversion behavior, you can userenderparameters, for examplerender=trueforce conversion,render=falsedisable conversion.

pageDetailThe supported parameters of the tag include:

  • id: The ID of the single page, used to specify the page to be retrieved accurately. If not provided, the single page information of the current page will be retrieved by default.
  • token: Single page URL alias, can also be used to specify the page to be retrieved.
  • siteId: withpageListSimilar, used to specify the site ID in a multi-site environment.

BypageDetail, fields you can access include:Id(Page ID),Title(Page Title),Link(Page Link),Description(Page Description),Content(Page Content),Logo(Full-page thumbnail large image),Thumb(Full-page thumbnail) as well asImages(Full-page slide set).

When you need to display multiple images on a single page (such as Banner images or slides),ImagesThe field will return an array. You can iterate through these images one by one:

{% pageDetail pageImages with name="Images" %}
<ul>
{% for item in pageImages %}
  <li>
    <img src="{{item}}" alt="{% pageDetail with name="Title" %}" />
  </li>
{% endfor %}
</ul>

In AnQiCMS, the template file for a single page is usually agreed upon aspage/detail.html. If you wish to use a separate template for a specific single page (such as a page with ID 10), you can name itpage/detail-10.html. Further, you can specify a custom template name for a specific page in the single-page management background, for exampleabout.html, and then place the file in the template directory underpage/about.html.

BypageListandpageDetailThese powerful tags, as a website operator, you can easily handle the single-page content display of AnQiCMS, meeting various complex website layout and information presentation needs.

Frequently Asked Questions (FAQ)

How do I add a single page to the website navigation?

You can create or edit navigation links in the 'Website Navigation Settings' feature of the AnQiCMS backend.In the 'Link Type' select 'Category Page Link', then select the single page you want to add.This single page will display at the navigation location you specified.

Can I set a unique template for a specific 'About Us' page?

Yes, AnQiCMS supports the use of custom templates on single pages. You can create your custom HTML template files in the directory under the template.page/folder, for example,about.html. Then, edit the "About Us" page in the AnQiCMS background "Page Management", and fill in the "Single Page Template" fieldabout.htmlJust do it.

How should the SEO of a single page be optimized?

Each single page has an independent SEO setting area in the 'Page Management' section of the AnQiCMS backend.You can set 'SEO title', 'keywords', and 'single page description' (corresponding to Description) for each single page.These fields will be directly output to the page<title>and<meta>It is crucial in tags for search engine optimization. At the same time, it is recommended to ensure that the URL alias (custom URL) of a single page is descriptive and contains keywords to enhance SEO effects.

Related articles

How to get the details of the current access category, including the title, link, description, and custom fields?

As an experienced CMS website operator, I am well aware of the importance of high-quality and easily accessible content information for website user experience and search engine optimization.In Anqi CMS, obtaining detailed information about the current visited category is a very basic and frequent requirement in website construction. Whether it is used for page titles, navigation breadcrumbs, or detailed introductions on category pages, it is necessary to accurately call these data.Our AnQi CMS provides a powerful and flexible template tag system, making it extremely easy to obtain the title, link, description, and even custom fields of the current visited category

2025-11-06

How to use the `categoryList` tag to get and loop through the category list under a specified content model?

As an expert who has been deeply engaged in AnQiCMS content operations for a long time, I know the importance of the category list in website structure and user experience.Make flexible use of the `categoryList` tag, which can help us efficiently organize content, build a clear navigation system, and provide readers with a more accurate content discovery path.Below, I will elaborate on how to use the `categoryList` tag to retrieve and display the category list of a specified content model in a loop.## Use AnQiCMS's `categoryList`

2025-11-06

How to implement dynamic breadcrumb navigation in AnQiCMS template and customize the home page text?

As a senior security CMS website operator, I know that high-quality content and excellent user experience are the foundation of website success.With the powerful functions of AnQiCMS, we can not only efficiently manage content, but also provide users with a smooth and intuitive browsing experience through fine-tuned template customization.Today, let's delve deeply into how to implement dynamic breadcrumb navigation in the AnQiCMS template, and flexibly customize the home page text to enhance the usability and search engine friendliness of the website.

2025-11-06

How to dynamically generate the SEO title, keywords, and description of the current page and support the website name suffix?

As an experienced content management expert who is deeply familiar with AnQiCMS operations, I know the importance of Search Engine Optimization (SEO) for website traffic and user retention.The website's SEO title, keywords, and description (usually abbreviated as TDK) are key factors for search engines to understand page content and for users to decide whether to click.AnQiCMS provides a powerful and flexible mechanism that allows us to dynamically generate these important SEO elements and conveniently integrate the website name as a suffix to enhance brand recognition.

2025-11-06

How to use the `archiveList` tag to get the article list and support sorting by ID, views, or custom sorting?

As an experienced CMS website operation person, I know that efficient content management is crucial for attracting and retaining users.The template tag system provided by AnQi CMS is its strong point, among which the `archiveList` tag is the core of daily content display.It can help us flexibly extract articles, products, and other content from the database and sort and display them in the way we want.

2025-11-06

How to implement complete pagination functionality for the article list in AnQiCMS template?

As an expert deeply familiar with the operation of AnQiCMS, I know that a smooth, user-friendly website experience is crucial for attracting and retaining users.The pagination feature of a content list is the cornerstone of any content-intensive website, not only optimizing the user's browsing experience, but also an important aspect of search engine optimization.In AnQiCMS, achieving complete pagination for the article list is efficient and flexible through its powerful template tag system.

2025-11-06

How to get the title, link, and thumbnail of the previous and next articles of the current article?

As an experienced website manager familiar with the operation of Anqi CMS, I fully understand the importance of the details of content presentation to user experience and the overall performance of the website.The front and rear navigation function of the article detail page can not only effectively guide users to continue browsing and reduce the bounce rate, but also is an effective means to enhance the relevance between pages and optimize the internal link structure.An enterprise CMS provides a concise and efficient template tag, allowing us to easily achieve this function.--- ### Enhance Content Coherence: Implement Previous and Next Article Navigation in AnQiCMS In Website Content Operation

2025-11-06

How to display a list of recommended articles related to the current article content, supporting keyword search or manual association?

As an experienced CMS website operation person in the security industry, I know that high-quality content and accurate recommendations are important for improving user experience and website SEO.In the article detail page, effectively displaying recommended articles related to the current content can not only extend the user's visit time and reduce the bounce rate, but also optimize and improve the page weight and crawling efficiency through internal links.AnQi CMS provides flexible tags, supporting us to build this recommendation list through keywords or manual methods.### Implementing related article recommendations in AnQi CMS AnQi CMS uses a powerful template tag system

2025-11-06