How is the `archiveDetail` tag used to retrieve and display detailed content information for a single document?

Calendar 👁️ 71

In AnQi CMS,archiveDetailTags are a very core and practical tool in template creation, mainly used to obtain and display detailed content information of a single document. Whether it is a blog post, product details, news report, or any other content that needs to be displayed independently on a page, archiveDetailCan help you flexibly extract and display on the front page of the website.

archiveDetailAn overview of the core functions of the tag

The design purpose of this tag is to provide rich data support for a single document, allowing you to easily call various properties of the document when building a detail page.It is not limited to the title and content, but also includes SEO information, images, time, category, and various custom fields, thus achieving a highly customized page display.

archiveDetailBasic usage of tags

archiveDetailThe label usage is very intuitive. When you are on a document detail page, the system defaults to recognizing the current document and allows you to directly call its properties.If you need to retrieve data from a specific document, you canidortokenSpecify the parameters.

The basic syntax structure is usually like this:{% archiveDetail 变量名称 with name="字段名称" id="文档ID" %}

Among them:

  • 变量名称It is optional, if you do not set it, the label will directly output the field content.If set, you can assign the obtained content to a variable for further processing or multiple use in the template.
  • name="字段名称"Specify the specific attributes of the document you want to retrieve, such as title, content, etc.
  • id="文档ID"ortoken="文档URL别名"It is used to specify which document's data to retrieve. When you are on the document detail page, these two parameters are usually omitted, and the tag will automatically retrieve the document information on the current page.If you need to call the specified document on other pages, they are particularly important.

For example, you often see such usage on the document detail page.{{archive.Title}}Directly output the document title here. Thisarchiveis a global variable representing the document object of the current page.

Deep understanding of commonly used fields and applications

archiveDetailTag throughnameParameters can retrieve various fields of the document, which cover all aspects of the document and can meet the vast majority of display needs.

  1. Basic information and SEO

    • Document ID (Id), Title (Title) and link (Link), Description (Description)These are the basic information of the document, used for displaying the main content of the page and SEO optimization. You can easily place the document title in<h1>Description used in the tagmeta description.
    • SEO Title (SeoTitle) Keywords (Keywords)These fields are designed for search engine optimization, allowing you to set more targeted TDK (Title, Description, Keywords) for each document to enhance the performance of the document in search results.
    • Standard link (CanonicalUrl)When multiple URLs point to the same content, you can specify a canonical link to avoid duplicate crawling by search engines and improve SEO efficiency.
  2. Content main (Content) and directory (ContentTitles)

    • ContentThis is the main content of the document. It is worth mentioning that,Contentthe field supports lazy loading of images (lazy="data-src") and Markdown rendering (render=trueThis means that if your content contains a large number of images, you can enable lazy loading to optimize page loading speed;If your content is written in Markdown, the system can also automatically convert it to HTML for display, greatly enhancing the flexibility of content editing.
    • ContentTitles: If your document content structure is clear, containing multiple title levels, this field can return an array of titles, which you can use to automatically generate an article table of contents, enhancing the user's reading experience.
  3. Image display (Logo,Thumb,Images)

    • LogoandThumbUsed to retrieve the cover image and thumbnail of the document, suitable for the visual presentation on list pages or detail pages.
    • Images: If the document contains a set of images (such as product group images), this field will return an array of image URLs. You need to cooperateforwith loop tags to iterate and display all images.
  4. Time information (CreatedTime,UpdatedTime)

    • These fields return the timestamp of the document's creation and update time. Typically, you need to combinestampToDatetags to format it into a readable date and time format, such as{{stampToDate(archive.CreatedTime, "2006-01-02 15:04")}}.
  5. Category (Category)

    • archiveDetailThe tag can directly obtain the category information of the document.CategoryThe field itself is an object, you can further access itsTitle/Linkproperties, such as{{archive.Category.Title}}to display the category name.
  6. Custom field parameter (archiveParams)

    • In addition to the above built-in fields, the additional fields you customize for the document model in the background can also be usedarchiveDetailor a specialarchiveParamsTag retrieval. This provides you with great content expansion capabilities. You can directly access{{archive.您的自定义字段名}}by visiting, or usearchiveParamstags to traverse all custom parameters.

Practical scenario examples

In order to understand betterarchiveDetailThe application, let's look at some common scenarios:

Scenario one: Building a blog article detail page

On a typical blog article detail page, you may need to display the article title, publish time, category, tags, content, and views.

<article>
    <h1 class="article-title">{% archiveDetail with name="Title" %}</h1>
    <div class="article-meta">
        发布于:<span>{% archiveDetail with name="CreatedTime" format="2006年01月02日" %}</span>
        分类:<a href="{% categoryDetail with name='Link' id=archive.CategoryId %}">{% categoryDetail with name='Title' id=archive.CategoryId %}</a>
        浏览:<span>{% archiveDetail with name="Views" %}次</span>
    </div>
    <div class="article-content">
        {%- archiveDetail articleContent with name="Content" lazy="data-src" render=true %}
        {{articleContent|safe}}
    </div>
</article>

Here, we obtained the article title, formatted publication time, and throughCategoryIdThe link and name of the category were obtained, as well as the article view count.The content part enables lazy loading of images and Markdown rendering, ensuring rich content and efficient loading.

Scenario two: Display the product detail page

For a product detail page, in addition to the product name and detailed introduction, it may also be necessary to display the main product image, multiple product detail images, and product specifications, etc., as custom parameters.

<div class="product-detail-wrapper">
    <div class="product-image-gallery">
        <img src="{% archiveDetail with name='Logo' %}" alt="{% archiveDetail with name='Title' %}" class="product-main-image" />
        <ul class="product-thumb-list">
            {% archiveDetail productImages with name="Images" %}
            {% for img in productImages %}
            <li><img src="{{img}}" alt="{% archiveDetail with name='Title' %}" /></li>
            {% endfor %}
        </ul>
    </div>
    <div class="product-info">
        <h1 class="product-name">{% archiveDetail with name="Title" %}</h1>
        <p class="product-description">{% archiveDetail with name="Description" %}</p>
        <div class="product-specs">
            <h3>产品规格</h3>
            {% archiveParams params %}
            {% for item in params %}
            <p><span>{{item.Name}}:</span>{{item.Value}}</p>
            {% endfor %}
            {% endarchiveParams %}
        </div>
    </div>
    <div class="product-full-content">
        <h2>详细介绍</h2>
        {%- archiveDetail productContent with name="Content" %}
        {{productContent|safe}}
    </div>
</div>

In this example, we displayed the main product imageLogoand utilizedImagesthe field to loop through the product group images. At the same time, througharchiveParamsThe label traversed and displayed all custom product specifications, finally presenting

Related articles

How to use the `archiveList` tag in AnQiCMS templates to flexibly display document lists?

In AnQi CMS, when we need to dynamically display articles, products, or other document lists on the website, the `archiveList` tag is an indispensable core tool.It provides high flexibility and powerful features, whether you want to display the latest content, hot articles, products in specific categories, or even generate lists based on keyword search or custom filtering conditions, `archiveList` can easily handle it.### `archiveList` core functionality and basic usage `archiveList`

2025-11-08

How to set up independent templates for specific documents, categories, or single pages to control their display styles?

In AnQiCMS, setting up independent templates for specific documents, categories, or single pages is a key feature for achieving personalized content display and enhancing user experience on the website.This not only makes the website design more flexible, but also allows for precise style control for different types of content, thus better satisfying the brand positioning and content operation strategy.### Understanding AnQiCMS Template Mechanism AnQiCMS provides two main ways to apply custom templates: one is that the system automatically identifies and loads templates based on file naming rules

2025-11-08

What is the directory structure of AnQiCMS templates, and how to organize template files for efficient display?

Build and manage website templates in AnQiCMS, the first step is to understand its unique directory structure and file organization.This not only concerns the visual presentation of the website, but also affects the performance, maintainability, and future scalability of the website.A clear and reasonable template organization strategy can greatly improve the work of content operation and front-end development.### Overview of AnQiCMS Template System AnQiCMS uses a syntax similar to the Django template engine, with `.html` as the template file suffix, which allows developers familiar with this template language to get started quickly

2025-11-08

What are the basic conventions to follow when making AnQiCMS templates to ensure correct content display?

Build a website template in AnQiCMS, as if designing a beautiful appearance and a practical functional framework for the website.Ensure that the carefully designed content is accurately displayed to visitors, it is crucial to follow some basic template design conventions.These conventions can not only help you efficiently complete template development, but also ensure the stability of the website and the convenience of future maintenance. ### One, the organization and coding specifications of template files Firstly, AnQiCMS has clear requirements for the **location and naming** of template files. All template files should be written with `

2025-11-08

How to use `categoryList` and `categoryDetail` tags to build and display category navigation and details?

In website content management, category navigation and detail pages are the core paths for users to browse the website and obtain information, as well as an important basis for search engines to understand the website structure.A clear and intuitive classification system not only greatly enhances the user experience, but also effectively helps the website's SEO performance.For users of Anqi CMS, flexibly using the `categoryList` and `categoryDetail` template tags provided by the system can easily build powerful, beautiful, and practical classification navigation and detail display.--- ### One

2025-11-08

How do the `pageList` and `pageDetail` tags manage and display the single-page content of a website?

In website operation, single-page content (such as "About Us", "Contact Information", "Service Introduction", etc.) plays a crucial role.They are usually carriers that display the core information of a company, brand story, or specific service details.To efficiently manage and display these pages, AnQiCMS provides the `pageList` and `pageDetail` two core tags, making content organization and presentation both flexible and convenient.### Back-end management of single-page content In AnQiCMS back-end

2025-11-08

How to display the `tagList` and `tagDataList` tags showing the website tags and related document list?

In website operation, a tag (Tag) is an extremely useful content organization tool.They can not only help users find the content they are interested in faster, improve the user experience of the website, but also optimize the search engine's crawling and understanding of the website content, and have a positive effect on SEO performance.The AnQi CMS provides website administrators with a powerful and flexible tag management feature, through the `tagList` and `tagDataList` template tags, we can easily display tag lists and documents related to specific tags on the website.###

2025-11-08

How to use the `navList` tag to create and display multi-level navigation menus to optimize user browsing?

In website operation, a clear and intuitive navigation system is a key factor in improving user experience, guiding users to explore content, and even optimizing search engine rankings.A well-designed multi-level navigation menu can help visitors quickly find the information they need, reduce the bounce rate, and effectively enhance the in-depth access to website content.In AnqiCMS, the `navList` tag is the core tool to achieve this goal, allowing us to flexibly build and display hierarchical navigation menus to optimize the user's browsing path.### Understand the `navList` tag

2025-11-08