How to display the detailed content of a specified single page in AnQiCMS template?

Calendar 👁️ 51

In the operation of AnQiCMS website, the single-page (Page) feature is a very practical module that allows us to create and manage static pages independent of dynamic content such as articles or products, such as 'About Us', 'Contact Information', or 'Service Introduction', etc.These pages usually contain relatively fixed and important information, which needs to be presented to the visitors in a clear and direct manner.As an experienced operator of AnQiCMS, I am well aware of how to effectively use the template mechanism to accurately control the display of these single pages to meet diverse design and content needs.

Core Concept:pageDetailTag

AnQiCMS provides a dedicated template tagpageDetailThis tag is used to retrieve and display detailed information for a single page. It is the core control for outputting the content of a single page. ThroughpageDetailLabel, we can use the unique identifier (ID) of the page or a custom URL alias (tokenTo accurately specify the single page to be displayed and extract the various fields we need, such as title, content, link, images, etc.

Display the specified single page content in the template

The most common method to display specific single-page content in an AnQiCMS template is to utilizepageDetaillabel'sidortokenParameter.

For example, if you want to display the content with ID at a specific location on the website,1The "About Us" page, you can use the following syntax in your template file to get its title and content:

{% pageDetail aboutPage with id="1" %}
    <h1 class="page-title">{{ aboutPage.Title }}</h1>
    <div class="page-content">
        {{ aboutPage.Content|safe }}
    </div>
    <a href="{{ aboutPage.Link }}" class="page-link">了解更多</a>
{% endpageDetail %}

In this code block:

  • pageDetail aboutPage with id="1"Instruct the system to retrieve the ID of1Single page data, and assign it to the name ofaboutPage.
  • {{ aboutPage.Title }}Used to display the title of the single page.
  • {{ aboutPage.Content|safe }}Used to display the main content of the single page. It should be noted that,|safeThe filter is crucial here, it tells the template engine to output the content as safe HTML instead of escaping, which is necessary for content containing rich text editors.
  • {{ aboutPage.Link }}It will output the access link to the single page.

In addition to using the ID, you can also use the page's custom URL alias (tokenSpecify a single page. For example, if the alias of your "Contact Us" page is set tocontact-usHow to call:

{% pageDetail contactPage with token="contact-us" %}
    <h2 class="section-title">{{ contactPage.Title }}</h2>
    <p>{{ contactPage.Description }}</p>
    <div>
        {{ contactPage.Content|safe }}
    </div>
{% endpageDetail %}

Not specifiedidortokenIn the case of parameters,pageDetailThe label will try to get the single-page data corresponding to the current URL. This is in the detail template of the single-page itself (such aspage/detail.htmlIt is very convenient to use, you can directly display the information of the current page without any additional parameters.

Custom single page template

AnQiCMS provides a flexible template customization mechanism, allowing you to design unique designs for different single-page applications.In the background "Page Management" area, when you edit or create a single page, there will be a "Single Page Template" field.By default, all single pages will use/template/{你的模板目录}/page/detail.htmlthis file.

But if you want a specific single page to have a completely different layout or style, you can create a dedicated template file for it. For example, if you have an ID of5The "Service Process" page, and you want it to use a template namedservice-flow.htmla special template, you can follow the following steps:

  1. In the directory of the template you are currently using (for example/template/default/),service-flow.htmlThe file. This file can contain completely customized HTML structure and style.
  2. In the AnQiCMS backend, go to 'Page Management', find the ID of5Edit the "Service Process" page.
  3. Fill in the "Single Page Template" field.service-flow.html.
  4. Save the page.

This, when the user visits the 'Service Process' page, the system will no longer load the defaultpage/detail.htmlbut will use the one you specifiedservice-flow.htmlTo render content. AnQiCMS also supports naming templates according to ID, for examplepage/detail-5.htmlThe system will automatically recognize and apply. This method is particularly suitable for situations where unique displays are needed for a few important pages.

Rendering content processing

As mentioned earlier, the content of a single page is usually entered through a rich text editor, which may contain HTML tags. To ensure that this content is rendered correctly on the page,

Related articles

How to list all or specified types of single pages in AnQiCMS template?

Managing and displaying single pages in AnQiCMS is a common requirement for website operation, especially for static content such as 'About Us', 'Contact Information', and 'Terms of Service'.As an experienced AnQiCMS operator, I know that efficient use of template tags can greatly enhance the flexibility of content publishing and the maintenance efficiency of the website.This article will detail how to list all or specified types of single pages in the AnQiCMS template.### Understanding the Single Page Mechanism of AnQiCMS In AnQiCMS, a single page (Single

2025-11-06

How to get and display detailed information of a specified category in AnQiCMS template?

As an experienced CMS website operation personnel of an enterprise, I know that it is crucial to display content efficiently and accurately in templates for the attractiveness and SEO performance of the website.Category information is the core of website architecture, able to accurately obtain and present on the front-end page, not only improving user experience, but also providing a clear structure for search engine crawling.Today, let's discuss in detail how to obtain and display detailed information of a specified category in the Anqi CMS template.

2025-11-06

How to list category information in AnQiCMS templates by module or parent relationship?

A detailed guide to listing category information by module or parent relationship in AnQiCMS templates As an experienced AnQiCMS website operator, I know the importance of content organization.A clear, easy-to-navigate classification system not only improves user experience, but is also the foundation of SEO optimization.AnQi CMS, with its flexible content model and powerful template tag system, provides us with multiple ways to display category information in website templates according to module or parent-child relationship.This article will delve into how to make use of these features to build an efficient classification list.###

2025-11-06

How to generate breadcrumb navigation path in AnQiCMS templates?

As an experienced CMS website operation personnel, I am well aware of the importance of a clear and efficient website navigation system for user experience and search engine optimization (SEO).Breadcrumbs navigation is an important part of website auxiliary navigation, which can intuitively show the user's position on the website and provide a convenient return path.The AnQi CMS with its flexible template engine makes it easy and efficient to generate breadcrumb navigation in website templates.

2025-11-06

How to filter and display the document list in AnQiCMS template according to categories, models, recommended attributes, etc.

As an experienced AnQiCMS website operations manager, I fully understand the importance of efficient content management and flexible display.In AnQiCMS, the filtering and display of document lists are indispensable functions for building dynamic websites.Whether it is to display the latest articles under a specific category, or to differentiate products and news according to the content model, or to highlight recommended content, AnQiCMS's powerful template tags can help us easily achieve these needs.

2025-11-06

How to get the detailed information of the current document in AnQiCMS template (such as title, content, thumbnail)?

As an experienced AnQiCMS website operator, I am well aware of the importance of flexibly obtaining and displaying content in templates.AnQiCMS is a powerful template engine that makes content creation, editing, and publishing efficient and convenient.Today, we will delve into how to obtain detailed information about the current document in the AnQiCMS template, such as the title, content, and thumbnail, to help you better customize the front-end display of the website.

2025-11-06

How to display the link to the previous and next document in the AnQiCMS template?

As an experienced security CMS website operator, I am well aware of the importance of website content navigation for user experience and search engine optimization.Clear and convenient navigation not only guides users to delve into the website content, effectively extending their stay time, but also helps build a perfect internal link structure, enhancing the search engine's crawling efficiency and content weight.Today, we will discuss in detail how to flexibly display the previous and next document links of the current document in the AnQiCMS template.### Template Basics Review The template engine in AnQiCMS uses something similar to Django

2025-11-06

How to retrieve and display the document list related to the current document in AnQiCMS template?

As an experienced website operator familiar with the operation of Anqi CMS, I know the core value of content strategy for user experience and website growth.High-quality content not only requires careful creation, but also intelligent organization and presentation to ensure that readers can easily find more information that interests them.In the article detail page, how can you effectively display the list related to the current document, which is an important factor in improving user stickiness and page browsing depth.

2025-11-06