How to use the `archiveDetail` tag to get detailed information of a specific document?

Calendar 👁️ 82

As an experienced website operations expert, I know that content is the soul of the website, and how to efficiently and accurately present this content is an indispensable part of our daily work.In such a powerful content management system as AnQiCMS, making good use of the provided template tags can greatly improve our content operation efficiency.archiveDetailThis tag is the core tool for obtaining detailed information about specific documents, whether you are a content editor, front-end developer, or website administrator, mastering it will greatly facilitate your work.

archiveDetailLabel: Core Tool for Precisely Gaining Document Details

Imagine when a user clicks on an article or product detail page on a website, they expect to see complete, detailed and well-formatted information. AndarchiveDetailThe label, which is designed to achieve this goal for AnQiCMS.Its core function is to help us accurately extract and display all relevant information of a single document (which can be an article, product, or any specific entry under any content model).This means that we can not only obtain the title, content, and publication time of the document, but also retrieve its category, cover image, and any additional fields customized in the background, making each detail page full of vitality.

Master the basic syntax: Make document information as you wish

archiveDetailThe use of tags is very intuitive, and its basic syntax is usually presented as:

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

Let's analyze the key parameters one by one:

  • 变量名称This is not required, but strongly recommended.It allows you to store the data you obtain in a custom variable, which is convenient for repeating references in subsequent template code, making the code structure clearer.If you choose not to define a variable name, the label will directly output the value of the field.
  • name="字段名称"This isarchiveDetailThe core label, it specifies the specific document field you want to retrieve. AnQiCMS has a variety of fields, such asTitle(Document Title),Content(Document content),Link(Document link) etc., we will introduce some common fields in detail later.
  • id="文档ID"ortoken="文档URL别名"These two parameters are used to specify the document you want to retrieve accurately. Usually on the document detail page, AnQiCMS automatically recognizes the document ID of the current page, so most of the time you can omit these two parameters,archiveDetailIt intelligently retrieves information about the document currently being accessed. But when you need to display the details of a specific document on other pages (such as the homepage, sidebar),idortokenit comes in handy.
  • siteId="站点ID": AnQiCMS supports multi-site management. If you need to retrieve document information from another site, you can specify the ID of the target site through this parameter.This is very useful when building cross-site content aggregation or display.

Common document information fields and their application examples

archiveDetailTags provide rich fields, allowing us to display document information in multiple dimensions. The following are some of the most commonly used fields and their application scenarios in actual operation:

1. Core Information: Title and Link

  • Title(Document Title): This is the soul of the document, usually used as the page main title (H1).
    
    <h1>{% archiveDetail with name="Title" %}</h1>
    
  • Link(Document Link)Used to construct the document detail page URL, ensuring smooth access for users.
    
    <a href="{% archiveDetail with name="Link" %}">阅读更多</a>
    

2. Content Display: Smart processing of rich text and Markdown.

  • Content(Document Content): This is the main body of the document, which usually contains a large amount of text, images, and HTML structures. AnQiCMS providesContenta very flexible handling method for fields:
    • |safeFilter: Due toContentMay contain HTML code, output directly may be escaped. Add|safeFilter, can ensure that HTML content is correctly parsed and rendered.
    • lazy="data-src"Parameter: To optimize page loading speed, we can work with front-end lazy loading libraries, by this parameter to<img>label'ssrcproperties todata-srcor other custom properties.
    • render=true/falseParameterIf your content is in Markdown format (the Markdown editor is enabled on the backend),render=trueit will be automatically rendered as HTML. Otherwise,render=falseit will not be rendered.
    {# 结合safe和图片懒加载 #}
    <div class="article-content">
        {% archiveDetail articleContent with name="Content" lazy="data-src" %}
        {{ articleContent|safe }}
    </div>
    
    {# 渲染Markdown内容 #}
    <div class="markdown-body">
        {% archiveDetail articleContent with name="Content" render=true %}
        {{ articleContent|safe }}
    </div>
    

3. Visual Elements: Image Resources and Display

  • Logo(Cover Main Image)/Thumb(Thumbnail)/Images(Group photo): These fields are used to display the visual elements of the document, adding attractiveness to the page.
    
    {# 展示封面首图 #}
    <img src="{% archiveDetail with name="Logo" %}" alt="{% archiveDetail with name="Title" %}" />
    
    {# 展示组图(Images是一个数组,需要循环) #}
    <div class="gallery">
        {% archiveDetail archiveImages with name="Images" %}
        {% for imgUrl in archiveImages %}
            <img src="{{ imgUrl }}" alt="图片描述" />
        {% endfor %}
    </div>
    

4. Metadata and Time: Detailed Content

  • Description(Document Description)/Keywords(Keywords)/Views(Views): These are key information for SEO and user insights.
    
    <meta name="description" content="{% archiveDetail with name="Description" %}">
    <span>浏览量:{% archiveDetail with name="Views" %}</span>
    
  • CreatedTime(Creation Time)/UpdatedTime(Update Time): Data in timestamp format needs to be processed throughstampToDatea function to be displayed in a human-readable format.
    
    <span>发布于:{{ stampToDate(archive.CreatedTime, "2006年01月02日 15:04") }}</span>
    

5. Attribute Information: Classification and Model

Related articles

How to use the `archiveList` tag to get the document list in AnQiCMS template?

As an experienced website operations expert, and deeply familiar with AnQi CMS, I fully understand that how to efficiently obtain and display content is the core of building a website.Today, let's delve deeply into an extremely important and powerful tag in the Anqi CMS template, `archiveList`, which can help us flexibly obtain various document lists and provide endless possibilities for the presentation of website content.

2025-11-07

What are the functions of the 38 commonly used tags in AnQiCMS templates?

As an experienced website operations expert, I have a deep understanding of the powerful functions of AnQiCMS (AnQiCMS) and its flexible template system.It is not just a content management system, but also a tool that empowers enterprises and content operation teams, especially in terms of content display and management. Its core lies in a set of elegantly designed and feature-rich template tags system.Today, let's delve deeply into the 38 commonly used tags in the Anqi CMS template, see what roles they play, and how they help us easily build and manage all kinds of websites.

2025-11-07

What are the naming conventions for the document detail page and list page template files in AnQiCMS?

As a senior website operation expert, I am well aware that the naming rules of a content management system template are not only technical details, but also the foundation of content operation efficiency and website maintainability.AnQiCMS (AnQiCMS) is designed with flexibility and efficiency, and also provides clear and practical naming conventions in template management, allowing developers and operators to operate with ease.Today, let's delve into the naming rules of AnQiCMS's document detail page and list page template filenames to help you better master this powerful tool.

2025-11-07

How to include header, footer, and other common code snippets in AnQiCMS templates?

## AnQiCMS template development: clever integration of common code snippets, making your website maintenance more efficient When operating a website, we often find that many pages share the same basic structure, such as the website header, footer, sidebar navigation, or a general ad slot.If you have to rewrite this code for each page repeatedly, it is not only inefficient but also, once you need to make changes, you have to adjust them one by one, which is undoubtedly a nightmare for website maintenance.It is good that AnQiCMS is an enterprise-level content management system developed in Go language

2025-11-07

How to implement navigation between previous and next document sections using the `prevArchive` and `nextArchive` tags?

## Easily Navigate: How to Use `prevArchive` and `nextArchive` Tags for Smart Article Navigation in AnQiCMS As an experienced website operator, we know that website content is not just about publishing. How to allow users to smoothly browse through massive amounts of information and find the next article they are interested in is crucial for improving user experience, extending stay time, and even optimizing SEO. In the powerful and flexible content management system AnQiCMS (AnQiCMS)

2025-11-07

How to get the specified model or sub-categories under the parent category of the `categoryList` tag?

## Taming AnQiCMS `categoryList` tag: How to efficiently obtain the specified model and subcategories under the parent category In the daily operation of AnQiCMS, content classification is the core of the website structure, which not only relates to the smoothness of the user's browsing experience but is also a key element that cannot be ignored in search engine optimization (SEO). In order to help everyone better manage and display website content, today we will delve into a very practical and powerful template tag in AnQiCMS——`categoryList`

2025-11-07

How to call the document's Tag list with `tagList` tag?

## The Powerful Assistant for Content Operation: The Clever Use of `tagList` Tag in AnQiCMS In the vast sea of the Internet, how to efficiently organize information, make it easy to find, and ultimately reach the target users accurately is a problem that every content operator is thinking about. AnQiCMS (AnQiCMS), as a content management system designed for enterprises and self-media, understands this pain point and provides powerful tools such as `tagList` in its powerful template tag system, helping us easily master content tags and add the charm of classification and aggregation to the website.

2025-11-07

How to implement pagination display for the document list with `pagination` tag?

As an experienced website operations expert, I know that an efficient content management system (CMS) is the cornerstone of website operations.AnQiCMS boasts a simple and efficient architecture with rich features, performing excellently in content publishing and management.Today, let's delve deeply into a seemingly simple but extremely important feature in AnQiCMS—the `pagination` tag, which elegantly implements pagination display of document lists to optimize user experience and enhance website performance.

2025-11-07