How to precisely control the display of document title, introduction, content, and other elements on the article detail page?

Calendar 👁️ 65

The article detail page is the core display area of the website content, which directly affects the user's experience in obtaining content and the perception of the website's professionalism.For AnQiCMS users, mastering how to finely control the display of various elements on article detail pages can not only enhance the visual appeal of the website but also optimize the user's reading path, effectively improving SEO performance.

AnQiCMS as a flexible content management system, provides various ways to help us accurately adjust the title, summary, body, and other additional information display of the article detail page.This is due to its powerful template engine and backend configuration features.

Understanding the 'skeleton' of the article detail page: template file

In AnQiCMS, the display of article detail pages cannot do without the support of template files. It is like a 'frame' for content, determining the layout and style of the content.

First, each template set has a default document detail page template, usually located/{模板目录}/{内容模型}/detail.htmlFor example, if it is an article model, it may bearticle/detail.html. This file defines the common layout of all article detail pages under the model.

Secondly, if you want to use a different layout for articles in a specific category, such as articles under the "Industry News" category, AnQiCMS also supports specifying independent templates for categories.You can edit categories in the background, and set the "category template" in the "other parameters".For example, set tonews_list.htmlSo if the file exists in your template directory, the category and its subcategory articles will apply this template.

Further, Anqi CMS also supports specifying independent templates for individual documents. When editing article details, you can specify a unique template file for a particular article through the "Other Parameters" section under the "Document Template" field, for examplespecial_report.htmlThis article can completely break away from the general layout and show a personalized design.

Apply these template files flexibly is the first step to precisely control the display of article detail pages.

Core tool:archiveDetailTag

Inside the template file, the core tag for achieving fine-grained control over the article detail page content is undoubtedlyarchiveDetail. This tag allows us to call various field information of the article as needed.

The method of invocation is usually{% archiveDetail 变量名称 with name="字段名称" %}. If no variable name is defined, it will output the result directly; if a variable is defined, such as{% archiveDetail articleTitle with name="Title" %}So it can be passed through{{articleTitle}}reference. In addition, you can also use it directly in the context of the article detail page.{{archive.文档字段}}to call the fields of the current document.

Let's see how to use it to control the display of different elements:

  • Title and SEO information: present accurately

    • Document title (Title): This is the main title of the article, usually used on the page.<h1>Labels directly affect user reading and SEO. We can go through{{archive.Title}}or{% archiveDetail with name="Title" %}to display.
    • SEO Title (SeoTitle): If you want the page's<title>The label content is different from the article title, it can be set as "SEO Title" in the background. It can be called in the template by{% tdk with name="Title" %}to call the page's<title>The content will prioritize displaying the SEO title of the document, followed by the document title, and whether to add the website name suffix can be decided according to the backend settings.
    • Keywords (Keywords) and description (Description)These two are important components of SEO optimization. They can be{% tdk with name="Keywords" %}and{% tdk with name="Description" %}used as tags for themetatags to guide search engines to understand the page topic. At the same time, theDescriptionThe field is often used as the summary of an article, which can be accessed directly.{{archive.Description}}or{% archiveDetail with name="Description" %}It is displayed above the main text, guiding the reader.
  • Main content: flexible control.

    • Document content (Content)This is the main part of the article. Pay attention to safety and format when displaying.
      • If the article content contains HTML tags, in order to avoid them being automatically escaped to plain text by the AnQiCMS template engine, we need to use|safeFilter, for example{{archive.Content|safe}}This allows images, links, and other HTML structures to be rendered in the text.
      • If your content is written in Markdown editor in the background and you want to automatically convert it to HTML display on the front-end, you canarchiveDetailthe tag withrender=trueparameters, for example{% archiveDetail articleContent with name="Content" render=true %}{{articleContent|safe}}This allows Markdown syntax to be correctly parsed.
  • Visual focus: Illustration and cover

    • Cover main image (Logo) and thumbnail (Thumb): Typically used on article list pages or social sharing, but sometimes also need to display a main visual image on detail pages. They can be accessed by{{archive.Logo}}and{{archive.Thumb}}to call.
    • Cover group (Images)If an article contains multiple cover images (such as the carousel on the product details page),Imagesthe field will return an image array. You need to cooperate withforLoop tags to iterate and display these images, for example:
      
      {% archiveDetail articleImages with name="Images" %}
      {% for img in articleImages %}
          <img src="{{img}}" alt="{{archive.Title}}" />
      {% endfor %}
      
    • It is worth mentioning how these images are processed (whether to generate WebP format, whether to compress, thumbnail size, etc.), all of which can be globally configured in the "Content Settings" backend, thereby affecting the final display effect on the front end.
  • Time, views and other basic information

    • Publish time (CreatedTime), and Update time (UpdatedTime): Pass{{archive.CreatedTime}}Timestamp can be obtained. To format it into a readable date and time, you can usestampToDateFilter, for example{{stampToDate(archive.CreatedTime, "2006-01-02 15:04")}}.
    • Views (Views): Use directly{{archive.Views}}to display the number of times the article has been read.
    • Category information (Category): The category information of the article can be obtained througharchive.Categoryan object to display the category name (archive.Category.Title) or category link (archive.Category.Link) for breadcrumb navigation or related article links.

Customization and Expansion:archiveParamsTag

In addition to the built-in fields of AnQiCMS, we can also add custom fields to the article or product model through the "Content Model" feature in the background, such as "Article Author", "Product Price", "Product Features", etc. These custom fields are a reflection of the flexibility of AnQiCMS, and their display on the article detail page requires the help ofarchiveParams.

  • Call a specific custom fieldIf you know the name of the custom field (for exampleauthorIt can be directly passed through{% archiveDetail with name="author" %}to retrieve and display its value.
  • Loop to display all custom fieldsIf you are not sure about which custom fields there are, or want to dynamically display them, you can usefora loop to iterate:
    
    {% archiveParams params %}
    {% for item in params %}
        <div>
            <span>{{item.Name}}:</span>
            <span>{{item.Value}}</span>
        </div>
    {% endfor %}
    
    This is particularly useful when displaying product parameters on the product detail page.

Rich association: Tags and navigation

To enhance user experience and content depth, the article detail page often also displays some related content:

Related articles

How to filter and display the document list based on categories, models, recommended attributes, and other conditions?

Today, with the increasing refinement of content management, how to make the document list of a website flexible to display according to different needs is a core skill that every website operator needs to master.AnQiCMS (AnQiCMS) takes advantage of its powerful template tag system, providing us with an extremely convenient and efficient solution.This article will delve into how to accurately filter and display your document list in AnQiCMS based on various conditions such as categories, content models, and recommendation attributes.--- ### **Core Tool: `archiveList`

2025-11-09

How to flexibly control and display the website navigation list (multi-level navigation) in the template?

In website operation, a clear and efficient navigation system is undoubtedly the foundation of user experience and search engine optimization.A well-designed navigation can not only guide users to quickly find the information they need, but also help search engines better understand the structure of the website.In AnQiCMS, we have powerful tools to flexibly configure and display multi-level navigation lists, thereby meeting diverse website needs. ### Step 1: Flexibly configure the navigation menu in the background AnQiCMS's navigation management feature is very intuitive.First, we will set up the core menu structure in the background "navigation settings"

2025-11-09

How to configure the TDK (title, keywords, description) of the homepage to enhance SEO display effect?

When we search for a keyword in a search engine, besides the sorting of search results, the first thing that catches our eye is the title, URL, and a brief description of each result.These are the three parts that we commonly refer to as website TDK - Title, Keywords, and Description.They are like your website's 'business card' on search engines, directly affecting whether users click to enter your website and how search engines understand your website's theme.The configuration of TDK is particularly crucial for the homepage of the website

2025-11-09

How to call and display contact information configured on the back-end in the website frontend?

It is crucial to clearly and conveniently display a company's contact information in modern website operations.AnQiCMS (AnQiCMS) understands this need and provides flexible and easy-to-operate backend configuration options, allowing you to dynamically display contact information on the website front end without writing complex code.This article will introduce in detail how to configure and call these contact methods in Anqi CMS, so that your users can find you first time. --- ### One, backend configuration contact information: Information Source All the data displayed on the front-end originates from the careful configuration of the backend.In Anqi CMS

2025-11-09

How does AnQiCMS handle images in document content (such as remote image download, Webp format conversion)?

## Mastering the Whole Picture: How AnQi CMS intelligently handles document content images, enhancing website loading speed and user experience In today's content-king digital age, the expressiveness, loading speed, and search engine friendliness of website images are crucial for user experience and SEO.A high-efficiency content management system should provide powerful and convenient functions in image processing.AnQiCMS (AnQiCMS) is well-versed in this field, helping users easily optimize website images through a series of intelligent image processing mechanisms. No matter where the images come from or in what format they exist, they will be properly handled

2025-11-09

How the generation and processing method of thumbnails (such as cropping, padding) affects the front-end image display?

Optimize website image display: In-depth analysis of Anqi CMS thumbnail processing method In content management, images are an indispensable element to attract users and convey information.Whether a website image is clear, beautiful, and loads quickly directly affects the user experience and the overall professionalism of the page.And the thumbnail as the first impression of the image display, its generation and processing method is particularly important.AnQiCMS (AnQiCMS) provides a flexible thumbnail generation and processing mechanism for image management, allowing us to finely control the display effect of front-end images according to the needs of different scenarios.### Thumbnail

2025-11-09

How to retrieve and display detailed information of a specified category (such as title, description, Banner image)?

In website operation, we often need to create unique and attractive display pages for specific categories, or flexibly call some detailed information of certain categories at different locations.For example, you may wish to display a dedicated Banner image at the top of a product category page, or list the title and introduction of a specific service category in the sidebar.AnQiCMS as an efficient and customizable content management system provides a very intuitive way to meet these needs.To obtain and display detailed information about a specified category, such as the title, description, and Banner image

2025-11-09

How to customize a template to achieve personalized display of single-page content (such as "About Us")?

In website operation, personalized display is crucial for shaping brand image and enhancing user experience.Especially single pages like "About Us" and "Contact Information", which carry the core information of the enterprise, can better convey the brand story and enhance the user's trust through customized design.AnQiCMS (AnQiCMS) provides a flexible way to achieve this goal, even for users with little technical background.### Understanding the Single Page Content Mechanism of Anqi CMS In Anqi CMS, single page content (such as "About Us")

2025-11-09