How to customize the layout and content display of the article detail page in AnQi CMS?

Calendar 👁️ 66

AnQiCMS (AnQiCMS) is a highly flexible content management system that provides great freedom for content operators, especially in customizing the layout and content display of article detail pages.Understanding the underlying mechanism and operational methods can help us better create personalized pages that meet user needs and optimize SEO performance.

Why do you need to customize the article detail page?

In website operation, the article detail page is not just a carrier of content, but also a key point of deep interaction between users and information, and the key point for achieving transformation goals.A standardized template is convenient and fast, but it often fails to meet all personalized needs.Customizing the article detail page allows us to flexibly adjust the page layout based on the article type, content features, or marketing objectives, highlighting key information, improving the user reading experience, and ultimately optimizing the page conversion rate and SEO performance.For example, an article reviewing a product may need a more prominent product parameter area and purchase link, while an industry analysis report may require clear table of contents and downloadable PDF links.

The core mechanism of AnQiCMS detail page customization

The powerful customization ability of AnQiCMS mainly benefits from its template system based on the Django template engine syntax, flexible content model, and refined backend configuration.

  1. Flexible template engine and file structure:AnQiCMS is used.htmlAs the template file suffix, and all templates are stored in/templateUnder the directory. It supports Django style tag syntax, such as{{变量}}Used to output content,{% 标签 %}Used to control logic. This structure makes the template file clear and easy to understand, convenient for modification and expansion.
  2. Content model and custom fields: AnQiCMS allows us to customize content models according to business needs and add unique custom fields to each model.For example, we can add an "author bio" field to the "article" model, and a "product parameters" field to the "product" model.These custom fields are the basis for personalized content display.
  3. Organizing and naming conventions of template files:In/templateWithin the directory, AnQiCMS follows a set of naming conventions to identify and apply different templates. For article detail pages, we can create specific content models under the root directory of the template.detail.htmlfiles (such asarticle/detail.htmlorproduct/detail.html),This will serve as the default detail page template for all articles under this model. Furthermore, AnQiCMS even supports creating exclusive templates for individual articles or products, such as{模型table}/detail-{文档ID}.htmlThis provides the possibility for extremely personalized page design.

Specific steps and methods for customization

There are mainly the following methods to customize article detail pages in AnQiCMS:

Method one: Cover through template file naming

This is the most direct and flexible way to customize. We just need to follow the template naming conventions of AnQiCMS, create or modify the corresponding files.

  1. Modify the general detail template:If we want all the detail pages of the "Article" model (or the "Product" model) to adopt a new layout, we can find it or/template/{你的模板目录}/{模型table}/Create in the directorydetail.htmlfile. For example,default/article/detail.html. The system will automatically recognize and apply this file as the default detail page for the model article.
  2. Create an independent template for a specific article:For some articles with special display requirements (such as promotional pages, special content), we can create in the template directory{模型table}/detail-{文档ID}.htmlA formatted file. For example, if an article with ID 123 needs a unique design, it can createarticle/detail-123.htmlThe AnQiCMS will load this specific ID template first.

Method two: specify the template through the backend settings

In addition to following the file naming conventions, AnQiCMS also provides an option in the backend management interface to specify custom templates for articles or categories.

  1. Specify in the article editing page:When we edit a specific article, in the "Other Parameters" area, there will be a "Document Template" field. Here, we can enter the path and filename of a custom template, for examplecustom/article_special.html. The system will load the specified template file according to this setting to render the detail page of the article. This template file needs to be placed in advance./template/{你的模板目录}/directory.
  2. specified in the category editing page:AnQiCMS also allows us to specify a unified detail page template for all articles under a certain category.When editing categories, fill in the template path in the "Other Parameters" area of the "Document Template" field.This, all articles in this category (if they have not specified a document template separately) will use this template.This is very useful for websites that need to be styled uniformly by category topics.

Method three: Deeply customize content display (using template tags)

No matter which way we specify the template file, once inside the template, the rich template tags of AnQiCMS become the key to our flexible control of content display.

  1. Get article details data: {% archiveDetail %}Tags are the main tools to get the core information of the article. On the article detail page, we usually do not need to specifyidortokenThe parameter automatically retrieves the article data on the current page. We can getnameparameters to get various fields of the article, such as:

    • {% archiveDetail with name="Title" %}Get the article title.
    • {% archiveDetail with name="Content" %}get the main content of the article. It is worth noting that,ContentField supportslazy="data-src"Used for lazy loading of images, as well asrender=true/falseto control whether Markdown content is converted to HTML.
    • {% archiveDetail with name="Logo" %}To get the cover image of the article,{% archiveDetail with name="Thumb" %}Retrieve thumbnails,{% archiveDetail archiveImages with name="Images" %}then used to get multiple images.
    • {% archiveDetail with name="CreatedTime" format="2006-01-02" %}Format the display of the publishing time.
    • We can also use it directly.{{archive.Title}}/{{archive.Content|safe}}In this way, you can call the field content of the current article.
  2. Display custom fields:For additional fields defined in the content model, there are multiple display options:

    • Call directly:If the custom field name isauthor_introCan be used directly in the template{% archiveDetail with name="author_intro" %}To output their values.
    • Loop traversal: {% archiveParams params %}The tag can iterate and display the names and values of all custom fields. This is very convenient when it is necessary to dynamically display all parameters, such as the parameter list on the product detail page.
  3. Integrate related content and features:

    • Previous/Next:Use{% prevArchive %}and{% nextArchive %}Tags can easily realize the navigation of the previous and next articles, enhancing the user's browsing depth within the site.
    • Related articles: {% archiveList archives with type="related" limit="10" %}Tags can recommend related articles based on the keywords or relationships of the current article, which helps users discover more

Related articles

How to convert the original image address to a thumbnail address for display?

In modern website operations, images play a crucial role, not only enhancing the attractiveness of the content but also effectively conveying information.However, very large image files can significantly slow down website loading speed, harm user experience, and even affect search engine rankings.Therefore, converting the original image address to an optimized thumbnail address for display is an important part of website performance optimization.AnQiCMS as an efficient content management system fully considers the needs of image processing, built-in powerful thumbnail generation and management functions.Configure and template calls reasonably

2025-11-08

How to debug variables in a template and display their structure and values?

During the development and maintenance of website templates, we often encounter such situations: a page element does not display as expected, or data seems missing or incorrectly formatted.This is the key to quickly locate the problem, as you can clearly view the structure and specific values of variables in the template.For users who use AnQiCMS, the system provides powerful and convenient debugging tools to help us easily "penetrate" template data.Why do we need to debug template variables? Data is passed through variables in the AnQiCMS template.

2025-11-08

How to remove extra spaces or characters from a string before displaying content?

During the operation of a website, we often encounter unnecessary spaces, line breaks, or special characters in the content. These 'impurities' not only affect the appearance of the content and the user's reading experience, but may also have a negative impact on the layout of the page and search engine optimization (SEO).AnQiCMS (AnQiCMS) is an efficient content management system that provides flexible and powerful template functions, among which the built-in template filters are the tools to solve such problems.Before you display content on the page, clean the string

2025-11-08

How to concatenate or replace strings before displaying them?

In AnQiCMS (AnQiCMS) content operation, we often encounter the need to dynamically process strings displayed on the front end of the website.To enhance the user reading experience, optimize search engine inclusion, or maintain consistency in content display, flexibly concatenating or replacing strings is a very practical skill.AnQi CMS, with its efficient template engine based on Go language, provides us with powerful and convenient tools, making these operations easy to implement at the template level.String concatenation

2025-11-08

How to use the `archiveList` tag to display the latest 10 article titles and summaries on the homepage?

In Anqi CMS, the homepage often plays a crucial role in displaying the latest content and attracting visitors' attention.If you want to clearly list the latest 10 article titles and summaries on the homepage, the `archiveList` tag is the powerful tool to achieve this goal.It is flexible and easy to use, helping you easily display dynamic content in the most prominent position on the website.We need to display the titles and summaries of the latest 10 articles on the homepage by using the `archiveList` tag's core parameters

2025-11-08

How to call and display product custom parameters (such as price, stock) on the product detail page?

In website operation, especially for product display websites, product details are far more than just titles and descriptions.In order to better meet user needs, it is particularly important to display various personalized parameters such as product price, inventory, color, material, and so on.AnQiCMS (AnQiCMS) takes advantage of its flexible content model and powerful template tag features, allowing you to easily call and display these custom parameters on product detail pages.### Preparations: Define Product Custom Parameters To display custom parameters on the product detail page, you first need to define these parameters in the AnQi CMS backend

2025-11-08

How to implement lazy loading of images in article content to improve page loading speed and user experience?

In today's fast-paced online world, website loading speed is crucial for user experience and search engine rankings.If your website content contains a large number of images, optimizing their loading method will be a key step in improving website performance.Image lazy loading (Lazy Load) is a highly efficient solution. Why Image Lazy Loading is So Important? While website images can enrich content and enhance visual appeal, they are also often the main reasons for slow page loading.When a page carries many high-resolution images

2025-11-08

How to configure and display multilingual content in AnQi CMS to serve users in different regions?

In today's global internet environment, enterprises and content operators often need to provide content to users from different countries and regions.AnQiCMS (AnQiCMS) understands this need and therefore provides flexible and powerful multilingual content configuration and display capabilities, helping users easily expand into international markets and directly reach audiences with different language preferences.### Overview of AnQi CMS Multilingual Capabilities AnQi CMS considers multilingual support as one of its core strengths, aiming to provide users with a complete global content publishing solution

2025-11-08