How to display the detailed content of a specified article or product in AnQiCMS?

Calendar 👁️ 70

AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides an intuitive way to manage and display various content.When you want to display a specific article, product details, or any independent content page created through a content model on a website, the key is to make use of its powerful template tag features.

AnQiCMS calls the independent displayable content on the website, such as articles and products, 'documents' (archive).This unified design makes it very consistent and convenient to manage and call the detailed information of these contents.No matter what you want to display, whether it is a blog post, product details, or specific event information, it can be achieved through the same logic and tags.

Core tags:archiveDetailUsage of

To display the detailed content of a specified document, we mainly rely on the AnQiCMS providedarchiveDetailtag. This tag is specifically used to obtain detailed data for a single document.

In the template, if you are already on the detail page of a document, the system will automatically recognize and load the data of the current document, at this point you can directly go through{{ archive.字段名 }}The way to call the various information of the document. For example, to display the title of the current document, you can directly use{{ archive.Title }}.

If you need to explicitly retrieve the data of a specific document (not the data of the current page document) or to retrieve fields outside the defaultarchiveobject,archiveDetailThe label is particularly important. Its basic usage is:

{% archiveDetail 变量名称 with name="字段名称" id="文档ID" %}

Or through a URL alias:

{% archiveDetail 变量名称 with name="字段名称" token="文档URL别名" %}

here,变量名称is an optional parameter, if set, you can assign the obtained data to this variable and use it later.nameThe attribute is used to specify the specific field you want to retrieve, for exampleTitle(Title),Content(Content),Description(Description) and others.idortokenis used to precisely specify the content of the document you want to display.

Common fields called:

The AnQiCMS documentation includes a series of commonly used fields, such as:

  • Title (Title): {% archiveDetail with name="Title" %}or{{ archive.Title }}
  • Content (Content): {% archiveDetail with name="Content" %}or{{ archive.Content }}
  • Summary (Description): {% archiveDetail with name="Description" %}or{{ archive.Description }}
  • Link (Link): {% archiveDetail with name="Link" %}or{{ archive.Link }}
  • Publish time (CreatedTime):Need to cooperatestampToDateFunction to format, for example{{ stampToDate(archive.CreatedTime, "2006-01-02 15:04") }}
  • Cover main image (Logo): {% archiveDetail with name="Logo" %}or{{ archive.Logo }}
  • Thumbnail (Thumb): {% archiveDetail with name="Thumb" %}or{{ archive.Thumb }}
  • Category information (Category): {{ archive.Category.Title }}Get the category title or use{% categoryDetail with name='Title' id=archive.CategoryId %}

Pay special attentionContentField display:

When you display the document'sContentWhen content contains HTML tags, in order to ensure that the browser can correctly parse and render these contents, it is usually necessary to add|safeFilter. Moreover, if your content has enabled the Markdown editor,archiveDetailTags also supportrenderparameters to control whether Markdown is converted to HTML, as well aslazyParameters are used for lazy loading of images. For example:

{# 显示文档内容并解析HTML,如果开启Markdown则渲染,且图片支持data-src懒加载 #}
{% archiveDetail articleContent with name="Content" render=true lazy="data-src" %}
{{ articleContent|safe }}

Custom fields of content model display:archiveParamsTag

AnQiCMS has a major advantage in its flexible content model.You can add custom fields for different content models (such as article models, product models) in the background.archiveParams.

If you want to iterate and display all custom parameters of a document, you can do it like this:

{% archiveParams params %}
    {% for item in params %}
        <div>
            <span>{{ item.Name }}:</span>
            <span>{{ item.Value }}</span>
        </div>
    {% endfor %}
{% endarchiveParams %}

here,item.NameIs the name of a custom field (such as "article author"),item.ValueIs the corresponding value of the field.

If you know the name of the custom field (for example, you have added a field namedauthorCustom field), you can also call it directly througharchiveDetailTag to call it:

{# 直接获取名为'author'的自定义字段的值 #}
<div>作者:{% archiveDetail with name="author" %}</div>

Display the detailed content of a single page (Page):pageDetailTag

In addition to articles and products of this kind of "document", AnQiCMS also supports creating independent "pages" (such as "About Us", "Contact Us"). The logic for displaying the detailed content of a page is very similar to that for displaying documents, usingpageDetail.

The usage is consistent witharchiveDetailSimilarly, it can be accessed byidortokenSpecifying a single page and usingnameProperties to obtain specific fields (such asTitle/Content/Description/Logo/Imagesetc.).

{# 获取ID为5的单页标题 #}
{% pageDetail pageTitle with name="Title" id="5" %}
<h1>{{ pageTitle }}</h1>

{# 获取当前单页的内容 #}
{% pageDetail pageContent with name="Content" %}
<div>{{ pageContent|safe }}</div>

An example combining practical scenarios

Display of general article detail page:

Assuming you want to build a common article detail page, including title, category, publish date, tags, views, and main content.

<article>
    <h1>{{ archive.Title }}</h1>
    <div>
        <span>分类:<a href="{% categoryDetail with name='Link' id=archive.CategoryId %}">{% categoryDetail with name='Title' id=archive.CategoryId %}</a></span>
        <span>发布于:{{ stampToDate(archive.CreatedTime, "2006年01月02日") }}</span>
        <span>浏览量:{{ archive.Views }}次</span>
        <span>标签:
            {% tagList tags with itemId=archive.Id limit="10" %}
                {% for tag in tags %}
                    <a href="{{ tag.Link }}">{{ tag.Title }}</a>
                {% endfor %}
            {% endtagList %}
        </span>
    </div>
    <div class="content-body">
        {% archiveDetail docContent with name="Content" render=true lazy="data-src" %}
        {{ docContent|safe }}
    </div>
</article>

Product detail page display:

For the product detail page, in addition to the title and description, it may also be necessary to display custom product parameters (such as model, brand, color) and contact information.

`twig

<div class="product-images">
    <img src="{{ archive.Logo }}" alt="{{ archive.Title }}" />
    {# 如果有其他产品图片,可以通过 archive.Images 循环展示 #}
    {% if archive.Images %}
        {% for img in archive.Images %}
            <img src="{{ img }}" alt="{{ archive.Title }} - 更多图片" />
        {% endfor %}
    {% endif %}
</div>

<div class="product-info">
    <h1>{{ archive.Title }}</h1>
    <p class="description">{{ archive.Description }}</p>

    <div class="product-specs">
        <h3>产品参数:</h3>
        {% archiveParams params %}
            {% for item in params %}
                <div>
                    <span>{{ item.Name }}:</span>
                    <span>{{ item.Value }}</span>
                </div>
            {% endfor %}
        {% endarchiveParams %}
    </div>

    <div class="contact-info">
        <p>如需购买或咨询,请联系:</p>
        <p>电话:<a href="tel:{% contact with name='Cellphone' %}">{% contact with name="Cellphone" %}</a></p

Related articles

How to retrieve a list of articles or products in AnQiCMS and support pagination display?

How to efficiently display articles or product lists in a content management system and provide users with a smooth pagination experience is a common concern for website operators.AnQiCMS is a system developed based on the Go language, which makes everything intuitive and efficient through its flexible and powerful template tag system.Next, we will discuss how to take advantage of the built-in features of AnQiCMS to easily implement the list display and pagination functions of articles or products.

2025-11-08

How to get and display the content and title of a specific single page in AnQiCMS?

In AnQiCMS, a single page is a very practical part of the website structure, usually used to display static content such as "About Us", "Contact Information", etc.As a content operator, you may often need to retrieve and display the content and titles of specific single pages at different locations on the website.AnQiCMS provides an intuitive and powerful template tag, making this process very simple. ### Understanding Single Page in AnQiCMS One of the design philosophies of AnQiCMS is the high customizability of content.

2025-11-08

How to display the list and links of all single pages in AnQiCMS template?

In AnQiCMS, wanting to display a list and links of all single pages in a website template is actually a very common requirement, such as you may want to place a 'site map' or 'quick link' area at the bottom of the website, or you may need to list all 'service items' single pages in the sidebar.AnQiCMS provides a simple and powerful template tag that allows you to easily achieve this.### Understanding Single Page and Its Role In AnQiCMS, a single page (Page) is usually used to publish content that is relatively fixed

2025-11-08

How to display detailed information and description of the current category in AnQiCMS?

When operating the AnQiCMS website, we often need to dynamically display detailed information and descriptions of the current category on the category page, such as the title, introduction, large picture, and even custom fields.This not only helps users better understand the theme of the current page, but also effectively improves the page's SEO performance.The Anqi CMS provides very flexible and intuitive template tags, making this task easy and simple.### Get to know the `categoryDetail` tag

2025-11-08

How to display the previous and next article links of the current article in AnQiCMS template?

In content operation, providing navigation to the previous and next articles for each article can not only significantly improve the user's reading experience, but also effectively increase the internal links of the website, which is of great benefit to search engine optimization (SEO).AnQi CMS with its flexible template system makes the implementation of this feature intuitive and efficient.By using a short template tag, you can easily integrate this practical navigation mechanism on the article detail page.

2025-11-08

How to display related article recommendations on the AnQiCMS article detail page?

In website operation, the related article recommendation function on the article detail page can not only effectively improve the user's browsing depth within the site, reduce the bounce rate, but also guide users to discover more valuable content, indirectly improving the overall SEO performance of the website.AnQiCMS as a content management system that focuses on efficiency and scalability, provides flexible template tags, making it intuitive and convenient to implement this function. Let's discuss together how to elegantly implement related article recommendations on the article detail page of AnQiCMS.

2025-11-08

How to dynamically display custom parameter fields of articles or products in AnQiCMS?

When building and operating a website, we often need to display more information than just the title and content, such as product models, colors, inventory, or the author, source, and publishing platform of the article.AnQiCMS knows the importance of personalized content display, and therefore provides a highly flexible custom parameter field function, making website content management and frontend display both powerful and convenient.Next, let's delve deeper together on how to make full use of this feature in AnQiCMS, making your website content dynamic.### First Step

2025-11-08

How to use the filtering feature of AnQiCMS to display a document list under specific conditions?

How to manage a large amount of content in AnQiCMS and allow users to quickly find the information they need is one of the key factors in content operation.Fortunately, AnQiCMS provides powerful filtering functions, allowing you to flexibly display document lists according to specific conditions, thereby greatly enhancing the website's user experience and content search efficiency. ### Clearly define your filtering requirements: Starting from the backend content model To make use of AnQiCMS's filtering feature, you first need to clarify the conditions through which you want users to search for content.

2025-11-08