What detailed information can the `pageDetail` tag call on a single page (such as ID, title, content)?

As an experienced CMS website operation personnel, I know that efficient content management is crucial for the success of the website.The single-page is an important part of the website architecture, carrying core static information such as 'About Us', 'Contact Information', and 'Terms of Service'.pageDetailTags allow operators to flexibly call and display various detailed information on a single page.

pageDetailTags are data calling tools specially designed for single-page content in Anqi CMS template engine.It allows template developers and operators to accurately obtain detailed data for specific single pages and render it to the front-end pages of the website.pageDetailAll of them provide convenient access methods.

The basic syntax of the tag is{% pageDetail variableName with name="fieldName" id="1" %}Here,variableNameis an optional variable name, you can specify it as a convenient alias for referring to the data you get in the template.nameThe parameter is used to specify the specific information field you want to obtain from a single page. In addition,pageDetailthe label also supportsidparameter to specify the single page ID to be obtained, or bytokenParameters to refer to the URL alias of a single page.If neither of these parameters is explicitly specified, the tag will default to trying to retrieve the single-page detail corresponding to the current page.siteId参数则能让他们轻松地调用其他站点的单页面数据。

pageDetailThe single-page detailed information that can be called by the label is very comprehensive, covering all aspects from basic identification to rich text content and multimedia resources, ensuring the flexibility and richness of single-page display.

First, each single page has a unique identifier number, that isId. This is the core field used for identification and management of single pages. Following that isTitleIt represents the main title of a single page, which is usually the first text the user sees on the page. The access path of the page is throughLinkField provided, this field will dynamically generate the complete URL pointing to this single page.

To better support search engine optimization and provide a user overview,DescriptionThis field provides a brief description of the page, which is typically used in HTML meta tags or to display a summary of page content. The core content of a single page is stored inContentThe field supports rich text editing, including text, images, videos, and more. It is worth noting that if the Markdown editor is enabled on the backend,ContentThe field will automatically convert Markdown syntax to HTML for rendering by default; if you need more fine-grained control, for example, if you want to disable Markdown conversion, you can do so in the template byrenderParameter (set to)trueorfalse) for explicit specification.

In terms of visual presentation,pageDetailthe labels also provide various options.LogoThe field usually stores the URL of a large thumbnail or main visual image for a single page.Thumb字段则提供了一个标准尺寸的缩略图URL,常用于列表页或小尺寸展示。如果单页面需要展示一个图片画廊或轮播图,ImagesThe field will return an array of image URLs, and the template can iterate over this array to display multiple images.

The following are some specific template code examples that show how to call this detailed information:

To obtain the unique identifier of a single page:<div>单页ID:{% pageDetail with name="Id" %}</div>

To obtain the title information of a single page:<div>单页标题:{% pageDetail with name="Title" %}</div>

Get the URL link of a single page:<div>单页链接:{% pageDetail with name="Link" %}</div>

Get the descriptive content of a single page:<div>单页描述:{% pageDetail with name="Description" %}</div>

Get the main content of a single page and ensure safe HTML rendering. If Markdown rendering is needed, you can addrender=true:<div>单页内容:{% pageDetail pageContent with name="Content" render=true %}{{pageContent|safe}}</div>

Get the large thumbnail of a single page:<div>缩略图大图:<img src="{% pageDetail with name="Logo" %}" alt="{% pageDetail with name="Title" %}" /></div>

Get the standard thumbnail of a single page:<div>缩略图大图:<img src="{% pageDetail with name="Thumb" %}" alt="{% pageDetail with name="Title" %}" /></div>

When a single page contains multiple images, you can loop throughImagesthe field to display:{% pageDetail pageImages with name="Images" %} <ul> {% for item in pageImages %} <li> <img src="{{item}}" alt="{% pageDetail with name="Title" %}" /> </li> {% endfor %} </ul>

Through these rich fields, the Anqi CMSpageDetailThe tag provides strong content display capabilities for website operators.It simplifies the call logic of single-page content, allowing even complex static page layouts to be realized through concise template code, thereby enhancing the efficiency and flexibility of website content management.


Common Questions and Answers (FAQ)

  • Can it be used to manage multiple sites,pageDetailcall the single-page data of other sites using tags?OK.pageDetailtag supportsiteIdParameters. If you have configured multiple sites in the AnQi CMS backend and wish to call single-page data from other sites in the current site, you just need to specify in the tag.siteId="目标站点ID"The system will fetch single-page details from the specified site. This is very useful for cross-site content sharing or unified management.

  • ContentDoes the field default to Markdown conversion? If I only want to display pure HTML or plain text, how should I handle it? ContentThe behavior of the field depends on whether the Markdown editor is enabled in the background content settings.If enabled, it will attempt to convert Markdown to HTML.pageDetailofContentField additionrender=falseparameters, such as{% pageDetail pageContent with name="Content" render=false %}{{pageContent|safe}}。At the same time, to prevent the HTML code in the content from being automatically escaped by the browser and displayed as code instead of style, please make sure to use|safeFilter.

  • if you are usingpageDetailtag, and there is no explicit specificationidortokenParameter, what will happen?WhenpageDetailNo label providedidortokenWhen a parameter is specified, it will intelligently match and attempt to retrieve the details of the single page being viewed based on the current page URL path.This design makes it very convenient to create universal single-page templates. You do not need to manually specify an ID or alias for each single page, and the template can adaptively display the content of the current page.