As a senior security CMS website operations 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".The Anqi CMS provides powerfulpageDetailTags, allowing operators to flexibly call and display various detailed information on a single page.
pageDetailThe tag is a data call tool specially designed for single-page content in AnQi CMS template engine.It allows template developers and operators to accurately obtain detailed data for a specific single page and render it on the website's frontend.Whether it is the core text that needs to be displayed on the page, or the associated image resources,pageDetailAll of them provide convenient access methods.
The basic syntax of this tag is{% pageDetail variableName with name="fieldName" id="1" %}. Here,variableNameIs an optional variable name, you can specify it as an alias for convenience when referencing the data obtained in the template.nameParameters are used to specify the specific information field you want to retrieve from a single page. In addition,pageDetailThe tag also supports passing throughidParameter is used to specify the ID of the single page to be retrieved, or bytokenParameters are used to reference the URL alias of a single page. If neither of these parameters is explicitly specified, the tag will default to attempting to retrieve the single-page details corresponding to the current page.For operators managing multiple sites,siteIdParameters can allow them to easily call single-page data from other sites.
pageDetailThe tag can call up a very comprehensive single-page detail page, 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, namelyId. This is the core field used internally by the system to identify and manage single pages. Following it isTitleIt represents the main title of a single page, which is usually the first text that users see on the page. The access path of the page is throughLinkThe field provides, this field will dynamically generate a complete URL pointing to the single page.
To better support search engine optimization and provide user overview,DescriptionThe field provides a brief description of the page, which is usually used in HTML meta tags or as a summary display of page content. The core content of a single page is stored inContentIn the field. This field supports rich text editing, including text, images, videos, etc. It is worth noting that if the Markdown editor is enabled on the back end, ContentThe field will automatically convert Markdown syntax to HTML by default; if you need finer control, for example, to disable Markdown conversion, you can do so through the template.renderParameters (set totrueorfalse) for explicit specification.
In terms of visual presentation,pageDetailtags also provide a variety of options.LogoThe field usually stores the URL of a large thumbnail or main visual image for a single page and it is used forThumbThe field provides a standard thumbnail image URL, commonly used on list pages or for small displays. If a single page needs to display a gallery or carousel of images,ImagesThe field will return an array of image URLs, and the template can iterate over this array to display multiple images.
Here are some specific template code examples that demonstrate how to call these details:
To obtain the unique identifier of a single page:<div>单页ID:{% pageDetail with name="Id" %}</div>
To get the title information of a single page:<div>单页标题:{% pageDetail with name="Title" %}</div>
Retrieve the URL link of a single page:<div>单页链接:{% pageDetail with name="Link" %}</div>
Retrieve 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, it can be addedrender=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 use a loopImagesto display the field:{% 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, Anqi CMS'spageDetailThe label provides powerful content display capabilities for website operators.It simplifies the call logic of single-page content, allowing even complex static page layouts to be implemented through concise template code, thereby improving the efficiency and flexibility of website content management.
Frequently Asked Questions (FAQ)
Can you use tags to call single-page data from other sites in a multi-site management environment?
pageDetailTags can call single-page data from other sites in a multi-site management environment?Can.pageDetailTag supportsiteIdParameter. If you have configured multiple sites in the Anqi CMS backend and want to call single-page data from other sites on the current site, just specify it in the tagsiteId="目标站点ID"The system will then fetch the 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, and how can I only display raw HTML or plain text?ContentThe behavior of the field depends on whether Markdown editor is enabled in the backend content settings.If enabled, it will attempt to convert Markdown to HTML.If you want to ensure that the content is displayed as pure HTML or plain text without Markdown conversion, you canpageDetaila tag toContentadd a fieldrender=falseparameters, for example{% pageDetail pageContent with name="Content" render=false %}{{pageContent|safe}}Meanwhile, to prevent HTML code from being automatically escaped by the browser and displayed as code instead of style, you must use|safefilter.If you are using
pageDetailtag, no explicit specification has been madeidortokenWhat will happen with the parameter?WhenpageDetailNo tag providedidortokenWhen a parameter is specified, it will intelligently match and attempt to retrieve the details of the single-page view currently being browsed 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 IDs or aliases for each single page, the template can automatically display the content of the current page.