How to accurately display the detailed content of a specific AnqiCMS document on the front page, including the title, description, and image?

Calendar 👁️ 83

AnQiCMS (AnQiCMS) leverages its flexible content model and intuitive template tag system, allowing you to easily manage the display of website front-end content.When we need to accurately present the detailed content of a specific document on the front page, such as the title, description, full text, and related images, understanding its core mechanism and commonly used tags is particularly important.

Understand the content structure of Anqi CMS

In AnQi CMS, all content is organized based on the 'content model', such as common article models, product models, etc.Each model includes a series of standard fields (such as title, content, description, thumbnail) and additional fields customized according to your business needs.These fields are the basis for the content you retrieve and display on the front page.

Precisely obtain the core tags for specific document details:archiveDetail

Display the detailed content of a specific document precisely on the front-end page,archiveDetailThe tag is undoubtedly your '万能钥匙'. This tag is specifically used to retrieve all data from a single document, whether it is a standard field or a custom field.

How to specify the document to be displayed

UsearchiveDetailWhen labeling, you can specify which document's data to retrieve by the document ID or URL alias (token).

  • Specify by document ID.If you know the document's numeric ID, you can useid="[文档ID]"the parameters. For example,{% archiveDetail with name="Title" id="10" %}The document title with ID 10 will be retrieved.
  • Specify through the URL aliasIf your document URL uses an alias (usually pinyin or English), you can usetoken="[文档别名]"the parameters. For example,{% archiveDetail with name="Description" token="anqicms-features" %}.

If the current page itself is a document detail page, and you want to get the content of the current document, thenidortokenThe parameter can even be omitted, the system will automatically identify and load the data of the current document.

Accurately call each item

Once you pass througharchiveDetailOnce the tag locks the target document, you can go throughnameSpecify the specific field to be displayed.

  1. Display the document titleThe document title is the core of the content, you can usename="Title"to retrieve it. For example:

    <h1>{% archiveDetail with name="Title" id="1" %}</h1>
    

    If you want to display a SEO optimized title, you can usename="SeoTitle".

  2. Display document descriptionA brief description of the document is very important for both users and search engines. Usename="Description"and it is done:

    <p class="description">{% archiveDetail with name="Description" id="1" %}</p>
    
  3. Display document imageAnqi CMS provides a variety of image types for you to choose from:

    • Cover main image (Logo) or thumbnail (Thumb): Usually used for a single main image at the top of the list page or document.
      
      <img src="{% archiveDetail with name="Logo" id="1" %}" alt="{% archiveDetail with name="Title" id="1" %}" />
      
    • Document Group Image (Images): If the document contains multiple images (such as product showcase albums),Imagesthe field will return an array of image URLs. You need to useforloop to traverse and display them.
      
      <div class="gallery">
          {% archiveDetail docImages with name="Images" id="1" %}
          {% for img in docImages %}
              <img src="{{ img }}" alt="文档图片" />
          {% endfor %}
      </div>
      
  4. Display document contentThe document content usually includes HTML format, and may also include Markdown syntax that needs to be converted. When usingname="Content"Be sure to cooperate when obtaining the text.|safeA filter to ensure that HTML content is rendered correctly rather than being escaped. If your document content has enabled the Markdown editor, you can also addrender=trueParameters allow the system to automatically convert it to HTML:

    <div class="article-content">
        {% archiveDetail docContent with name="Content" id="1" render=true %}
        {{ docContent|safe }}
    </div>
    
  5. Display the publish time and update timeTime information is important for users to understand the timeliness of the content.CreatedTimeandUpdatedTimeThe field returns a timestamp, you need to usestampToDateThe filter to format it as a readable date and time:

    <span>发布于:{{ stampToDate(archive.CreatedTime, "2006年01月02日 15:04") }}</span>
    <span>更新于:{{ stampToDate(archive.UpdatedTime, "2006-01-02") }}</span>
    

    HerearchiveThe variable usually refers to the document object of the current page, or you can{% archiveDetail archive with ... %}Define the document variable.

  6. Show custom fieldThe strength of AnQi CMS lies in its flexible content model, you can add various custom fields (such as author, source, product parameters, etc.) to different models. To display these fields, you can directly use the field names they call:

    <p>作者:{% archiveDetail with name="Author" id="1" %}</p>
    

    If you want to iterate through and display all the custom parameters of the document, you can usearchiveParamsTags:

    <ul class="custom-params">
        {% archiveParams params with id="1" %}
        {% for item in params %}
            <li>{{ item.Name }}:{{ item.Value }}</li>
        {% endfor %}
    </ul>
    

Combine them together: a complete example

Assuming we want to display the "About AnQi CMS" document with ID 1, including the title, description, body, main image, and custom "version number" field:

``twig <!DOCTYPE html>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{# 调用页面SEO标题和描述 #}
<title>{% tdk with name="Title" siteName=true %}</title>
<meta name="description" content="{% tdk with name="Description" %}">
<link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">

<header>{# 网站头部导航等内容 #}</header>

<main class="container">
    <article class="document-detail">
        {# 获取ID为1的文档所有数据,并赋值给archive变量,以便后续直接调用 #}
        {% archiveDetail archive with id="1" %}

        <h1 class="document-title">{{ archive.Title }}</h1>

        <div class="document-meta">
            <span>发布时间:{{ stampToDate(archive.CreatedTime, "2006年01月02日") }}</span>
            <span>浏览量:{{ archive.Views }}</span>
            {# 假设您的内容模型中有一个“Author”自定义字段 #}
            {% archiveDetail authorName with name="Author" id="1" %}
            {% if authorName %}
                <span>作者:{{ authorName }}</span>
            {% endif %}
        </div>

        {# 显示文档主图 #}
        {% if archive.Logo %}
        <div class="document-featured-image">
            <img src="{{ archive.Logo }}" alt="{{ archive.Title }}" />
        </div>
        {% endif %}

        <p class="document-description">{{

Related articles

How to use AnqiCMS document list tags to display the latest, hot, or specified category of articles/products on the front page?

In AnqiCMS, flexibly displaying website content is the key to improving user experience and meeting operational needs.Whether you want to highlight the latest articles on the homepage, display popular products in the sidebar, or customize content lists for specific columns, AnqiCMS's powerful document list tags can help you a lot.By skillfully using these tags, you can easily achieve a diverse presentation of content, making your website more dynamic and attractive.### Core Tag: `archiveList`

2025-11-09

How to call and display the detailed content and images of a specific page in AnqiCMS on the front page?

In AnQiCMS, it is actually much simpler than you imagine to call and display the detailed content and images of a specific single page on the front page.AnQiCMS's powerful template tag system, especially the tags designed for single-page layouts, can help you achieve this easily. ### Understanding AnQiCMS Single Page Functionality Firstly, we know that AnQiCMS provides an independent "Page Management" module that allows us to create independent single pages such as "About Us", "Contact Information", or "Service Introduction".This page's content, images, SEO information, etc.

2025-11-09

How to use AnqiCMS's single page list tag to flexibly display independent pages such as 'About Us' on the front end?

In modern website operations, pages like "About Us", "Contact Information", and "Terms of Service" are independent pages that carry the basic information and brand image of the website. Although they are not updated often, they are crucial.AnqiCMS provides a flexible single-page management feature, combining its powerful template tag system, we can easily display these independent pages on the front end and customize them as needed.

2025-11-09

How to accurately call and display the detailed information of a specific category in AnqiCMS on the front page, including the description and Banner image?

In AnqiCMS (AnqiCMS), the need to accurately call and display detailed information about a specific category on the front page, such as the category description and its exclusive Banner image, is a common requirement.This can make the structure of the website content clearer, as well as improve user experience and the website's SEO performance.Benefiting from AnqiCMS flexible template tag system, achieving this goal is actually very direct. We mainly use a core template tag——`categoryDetail`.

2025-11-09

How to display the 'Previous' and 'Next' documents of the current document on the front page to enhance the user's browsing experience?

In AnQiCMS (AnQiCMS), adding "Previous" and "Next" navigation links to the front-end document pages is an important means to enhance user browsing experience and extend user stay time.When a user finishes reading an article, these links can guide them naturally to discover more related content, avoid interrupting page browsing, and effectively reduce the bounce rate, which also helps to enhance the overall weight of the website's content. AnQi CMS as a rich-featured Go language content management system, built-in with a powerful template tag system, allowing website operators to flexibly control content display. Among which

2025-11-09

How to display the AnqiCMS related document list on the front page to increase content relevance and user stay time?

In content operation, we all hope that users can stay longer on the website and browse more content.An精心 crafted article is indeed important, but how to connect it with other relevant content to form a content matrix is the key to improving user experience and reducing bounce rate.Imagine, after a user finishes reading an article about 'AnQi CMS Core Features', if the page below automatically recommends 'How to Build an E-commerce Site with AnQi CMS' or 'AnQi CMS Template Creation Tutorial', wouldn't it be more attractive for them to continue exploring?

2025-11-09

How to display the custom parameter fields of AnqiCMS documents on the front page, such as authors, sources, and so on?

In website operation, the flexibility of the Content Management System (CMS) is crucial.AnQi CMS, with its powerful customizability, allows us to add various custom parameter fields to content (such as articles, products, etc.) to meet diverse display needs.These custom fields, such as the 'author', 'source', 'model', 'color' of products, etc., can greatly enrich the dimensions and practicality of content.How can we elegantly present these personalized custom parameters to visitors on the website frontend after we have added them in the background of the document

2025-11-09

How to implement the AnqiCMS document parameter filtering function on the front page to help users quickly locate content?

How to help users quickly find the information they are interested in on increasingly rich content websites is a crucial operational challenge.Users often need to filter content based on specific conditions rather than browsing aimlessly.AnqiCMS provides a powerful document parameter filtering function that allows you to easily achieve this goal on the front page, greatly enhancing user experience and content discoverability.

2025-11-09