How does the `pageDetail` tag display the title, content, and thumbnail of a single page in AnQiCMS?

Calendar 👁️ 61

AnQiCMS provides an efficient way to manage independent pages, such as "About Us", "Contact Information", and so on.These pages usually have independent titles, content, and images, which need to be presented accurately in the front-end template.pageDetailThe tag is the core tool designed by Anqi CMS to achieve this purpose, it allows us to easily extract and display detailed information of a single page from the background database.

UnderstandingpageDetailLabel: The core of displaying single-page content

In AnQiCMS,pageDetailThe tag is specifically used to retrieve and display detailed data for a single page.Whether it is the title and content of the "company profile" you want to display, or the detailed text of the "terms of service", it can provide the required data.Use this tag and you can specifynameParameters to obtain specific fields of a single page, such as page title, specific content, or related images. IfnameThe parameter is omitted, the tag will directly output the entire data object of the single page, but this usually requires combining variable assignment to be effectively utilized.

pageDetailThe flexibility of the tag is reflected in its ability to retrieve data according to different needs:

  • idParameterWhen you want to display a single page with a specific ID, you can directly go throughid="页面ID"in order to specify precisely. For example,id="1"Get the single-page data with ID 1. If the current page itself is a single page (for example, the URL path you access is the address of the single-page), this parameter can usually be omitted,pageDetailThe system will automatically recognize and retrieve information from the current page.

  • tokenParameter: In addition to ID, you can also use the URL alias of a single page (tokenSpecify a page, which is very useful in certain scenarios where pages need to be located based on friendly URLs. Usage is similar toidfor exampletoken="about-us".

  • siteIdParameterFor scenarios where the AnQiCMS multi-site management function is used, if you need to retrieve single-page data from other sites, you can setsiteId="站点ID"To implement cross-site calls, which is very convenient for building websites with unified content sources in multiple languages or brands.

Obtaining and displaying core content fields

NowpageDetailLabel, we can conveniently obtain the various components of a single page:

  • Single page title (Title): This is the core identifier of a single page. You can use{% pageDetail with name="Title" %}Directly output the current single page title in the template. If you want to assign the result to a variable for subsequent use or logical judgment, you can write it like this:{% pageDetail pageTitle with name="Title" %}Then proceed{{ pageTitle }}Use this title flexibly.

  • Single page content (Content): The main information of the page is stored in this field. The way to get it is{% pageDetail with name="Content" %}It is worth noting that the content of a single page often contains rich HTML tags (such as content edited using a rich text editor in the background), in order to ensure that these tags can be correctly parsed and rendered by the browser rather than displayed as raw text, you usually need to combinesafeUse a filter, for example{{ pageContent|safe }}In addition, if your content is being edited in a Markdown editor in the background, you also need to ensure that the Markdown syntax is correctly converted to HTML, bypageDetailthe tag withrender=trueparameters, for example{% pageDetail pageContent with name="Content" render=true %}{{ pageContent|safe }}.

  • Single page thumbnail (Thumb) and large image (Logo)Both are used to display page images.LogoIt usually refers to the main image or large image on a single page, whileThumbis the thumbnail version. The methods of obtaining them are as follows.{% pageDetail with name="Logo" %}and{% pageDetail with name="Thumb" %}In the template, you usually use them as<img>label'ssrcto use as property values, for example<img src="{% pageDetail with name="Thumb" %}" alt="页面标题" />This will fill in the thumbnail address obtained into the image'ssrcthe attribute.

  • Single-page slide group (Images)Some single pages may need to display a group of images, such as a carousel or gallery.Imagesfield will return an array of image URLs. Since it is an array, you need to go throughforLoop to traverse and display these images. For example, you can first assign the image array to a variable{% pageDetail pageImages with name="Images" %}Then use{% for item in pageImages %}<img src="{{ item }}" alt="页面图片" />{% endfor %}Output each image one by one.

  • Other fields (Id,Link,Description): In addition to the above core fields,pageDetailTags can obtain the unique identifier of the pageId, the page access linkLinkand the brief description of the pageDescription. The way to obtain these fields is similar toTitle, just replace itnameThe value of the parameter can be. For example, getting the page link is{% pageDetail with name="Link" %}.

Practice exercise: Build a "About Us" page

Assuming you are building a 'About Us' single page and have created the page in the background. In your template file (such aspage/detail.htmlor a custom template specifically for the 'About Us' pagepage/about-us.htmlIn it, you can combine it like thispageDetailTags to display the full page content:

`twig {# Page main title #}

{% pageDetail with name=“Title”

Related articles

How to get and display the list of all single pages of AnQiCMS using the `pageList` tag?

In Anqi CMS, a single page is a very flexible content form that does not rely on complex classification or model structures. It is often used to publish independent and relatively fixed pages such as "About Us", "Contact Information", and "Service Introduction".These pages are characterized by independent content, usually requiring only one page to carry their information.When you need to display a list of single pages at specific locations on a website, such as the bottom navigation, sidebar, or a special topic page, Anqi CMS provides a dedicated `pageList` tag to make this operation simple and intuitive.###

2025-11-08

How does the `categoryDetail` tag display the specific category details of AnQiCMS, such as the introduction or Banner image?

In Anqi CMS template development, effectively displaying detailed category information is the key to improving website user experience and SEO performance.`categoryDetail` tag is born for this, it allows us to flexibly obtain and present various information of specific categories, from basic introduction text to visually stunning Banner images, it can easily handle.### Core Function Analysis: `categoryDetail` Tag Overview The `categoryDetail` tag is mainly used to obtain detailed data for a single category

2025-11-08

How to retrieve and display the list of AnQiCMS articles or product categories using the `categoryList` tag?

Build a feature-rich, content-packed website in AnQiCMS, categories are an indispensable part of organizing content.Whether it is to display articles, products, services, or build navigation menus, a clear classification structure can greatly enhance the user experience and maintainability of the website.Today, let's delve deeply into a very practical and flexible tag in AnQiCMS——`categoryList`, which can help you easily obtain and display a list of articles or product categories.The `categoryList` tag is a powerful tool in the AnQiCMS template engine

2025-11-08

How does the `breadcrumb` tag display the breadcrumb navigation path of the AnQiCMS page?

In website operation, clear navigation is a key factor in improving user experience and helping search engines understand the structure of the website.This is a direct navigation aid that can clearly show the hierarchical path of the current page, allowing visitors to always know where they are and where they can go.For users who use AnQiCMS to build and manage websites, achieving such navigation is simple and efficient, thanks to its built-in `breadcrumb` tag.###

2025-11-08

How to get and display the document list of the specified category and model in AnQiCMS using the `archiveList` tag?

In Anqi CMS, efficiently managing and displaying website content is the key to improving user experience and search engine rankings.In order to achieve this goal, we often need to organize and display document lists according to specific categories or content models.At this time, the `archiveList` tag has become a powerful tool in our hands.It can help us flexibly extract the required content from the database and present it in a variety of ways.

2025-11-08

How to display AnQiCMS articles with the `archiveDetail` tag?

When building rich web pages in AnQiCMS, the `archiveDetail` tag is undoubtedly the core tool for displaying article detail pages.It can flexibly obtain and present all the detailed information of articles or products, helping website operators easily create detail pages that match the brand image and user experience.

2025-11-08

How to customize the display layout of the article detail page in AnQiCMS?

In website operation, the article detail page is like the 'face' of the content, it not only carries the core information, but is also a key touchpoint for users to understand deeply and resonate.A well-designed, logically laid out detail page that highlights the value of the content, can significantly enhance the user's reading experience, effectively convey information, and even promote further interaction or conversion.AnQi CMS understands its importance and therefore provides highly flexible and customizable features, allowing us to easily create exclusive article detail pages with unique styles.

2025-11-08

How to achieve multi-language content switching and display in AnQi CMS?

Under the wave of globalization content marketing, website support for multiple languages has become an indispensable function.AnQiCMS (AnQiCMS) understands this need and provides a flexible multilingual solution to help us easily present content to users in different languages.This article will discuss in detail how to implement multi-language content switching and display in Anqi CMS.### Distinguishing System Language and Content Language Before delving deeper, we first need to clarify the concepts of two types of "languages" in Anqi CMS: 1. **System Backend Language Pack:**

2025-11-08