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 mechanisms 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 only a carrier of content, but also a key point of deep interaction between users and information, and the key to achieving conversion goals.The standardized template is convenient and quick, but often difficult 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, enhancing the user reading experience, and ultimately optimizing the page conversion rate and SEO performance.For example, an article reviewing a product may require a more prominent product parameter area and purchase link, while an industry analysis report may need clear table of contents navigation and downloadable PDF links.

EnglishQiCMS Detail Page Custom Core Mechanism

The powerful customization capability of AnQiCMS is mainly attributed to its template system based on Django template engine syntax, flexible content model, and refined backend configuration.

  1. Flexible template engine and file structure:AnQiCMS in use.htmlAs template file suffix, and all templates are stored in/templateThe directory. It supports Django-style tag syntax, such as{{变量}}Used for outputting content,{% 标签 %}Used for controlling 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 "articleThese custom fields are the basis for personalized content display.
  3. Template file organization and naming conventions:In/templateThe directory follows a naming convention to identify and apply different templates. For article detail pages, we can create specific content models in the root directory of the template.detail.htmlfiles (such asarticle/detail.htmlorproduct/detail.html),This will be 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 customization steps and methods

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

Method one: Override through template file naming

This is the most direct and flexible way to customize. We just need to follow the AnQiCMS template naming convention, 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 use a new layout, we can find or/template/{你的模板目录}/{模型table}/directory createdetail.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 certain articles with special display requirements (such as promotional pages, special content), we can create in the template directory{模型table}/detail-{文档ID}.htmlThe file format. For example, if an article with ID 123 requires a unique design, you can createarticle/detail-123.html.AnQiCMS will load this specific ID template first.

Method two: specify the template through the background settings

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

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

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

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

  1. Get article detail data: {% archiveDetail %}Tags are the main tools for obtaining the core information of articles. In the article detail page, we usually do not need to specifyidortokenThe parameter, it will automatically fetch the article data of the current page. We can use the parameter tonameto obtain various fields of the article, such as:

    • {% archiveDetail with name="Title" %}Get article title.
    • {% archiveDetail with name="Content" %}to get the main content of the article. It is worth noting that,Contentfields supportlazy="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" %}Get the thumbnail,{% archiveDetail archiveImages with name="Images" %}which is used to get multiple images.
    • {% archiveDetail with name="CreatedTime" format="2006-01-02" %}Format the display of the publish time.
    • We can also use it directly.{{archive.Title}}/{{archive.Content|safe}}And other ways to call the field content of the current article.
  2. 展示自定义字段:There are many ways to display additional fields defined in the content model:

    • Direct call:If the custom field name isauthor_introyou can use it directly in the template{% archiveDetail with name="author_intro" %}to output its value.
    • Loop traversal: {% archiveParams params %}Labels can iterate and display all custom field names and values. This is very convenient when it is necessary to dynamically display all parameters, such as the parameter list on the product detail page.
  3. Integration of content and features:

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