How to customize the display template for articles, products, and single pages in AnQiCMS?

Calendar 👁️ 76

In AnQiCMS, customizing the display templates for articles, products, and single pages is a very flexible and powerful feature that allows you to create dedicated display styles for different types of content based on the unique needs of your website.By carefully designed templates, not only can it enhance the user experience, but also better highlight the key points of the content, realizing the unity of brand style.

AnQiCMS uses a template engine syntax similar to Django, which means if you are familiar with this concise and intuitive syntax, you can get started quickly. Template files are usually written in.htmlwith suffix, and stored uniformly in/templateUnder the directory. Each template package has its own directory, internally throughconfig.jsonFiles define template information and support adaptive, code adaptation, and independent PC + mobile sites and other modes, ensuring that your website can perfectly present on different devices.

Customize the article display template flexibly

In AnQiCMS, the article display template can be customized in multiple layers.

First, each content model (such as the "article" model) has a default detail page template, usually named{模型table}/detail.htmlfor examplearchive/detail.htmlIf you have not specified a template for a specific article, the system will automatically use this default template.

When you want a specific article to have a unique display style, you can set it in the "Content Management" "Publish Document" or "Edit Document" interface in the background.In the "Other Parametersmy-special-article.htmlIt should be noted that this custom template file must actually exist in the template package you are using, otherwise the system will not be able to find and load the page.

Moreover, AnQiCMS also provides a convenient default naming convention: you can create a template file named{模型table}/{文档id}.htmlsuch asarchive/10.html), it will be automatically applied to the article with ID 10, without any additional configuration in the background. This method is especially suitable for scenarios where it is necessary to design a few key articles independently.

In these custom article templates, you can use{% archiveDetail %}tags to retrieve the details of the current article, such as{{archive.Title}}Display the article title,{{archive.Content|safe}}Display the article content(|safeThe filter is used to ensure that HTML content is rendered correctly, avoiding escaping). If the article model defines additional custom fields, they will also be automatically included in the template.{{archive.您的自定义字段名}}Call in the form.

Custom product display template

The product is also considered a content model in AnQiCMS, and its template customization process is very similar to articles. Usually, the default template of the product detail page is also{模型table}/detail.htmlfor exampleproduct/detail.html)

If you want a specific product page to have a unique layout or information display, you can also specify a custom template file in the "Other Parameters" field under the "Document Template" field when editing products in the background, for example,product-showcase.html.

When customizing the product template, you will find{% archiveDetail %}The tag is still the core of obtaining product data. It can help you retrieve the product name, image, description, and even various parameters customized through the content model, such as{{archive.Price}}or{{archive.Materials}}(Assuming you have defined the "price" and "material" fields). Combine{% archiveParams %}Label, you can also loop through all custom product parameters to flexibly build product specification lists.

Custom single page display template

Single-page pages (such as "About Us", "Contact Us") also provide independent template customization capabilities in AnQiCMS. By default, the detail page template of single-page pages ispage/detail.html.

If you want to design a unique style for a single page, you can edit the single page in the "Page Resources" "Page Managementabout-us.html.

Similar to the article, AnQiCMS also supports automatic application of templates through default naming conventions: if a file namedpage/{单页面id}.htmlexists, it will be automatically applied to the single page with the corresponding ID.

In a single-page template, use{% pageDetail %}tags to easily obtain the page title, content, thumbnail information, etc. For example,{{page.Title}}to get the title of the single-page,{{page.Content|safe}}to get the main content of the single-page.

Category page template customization

In addition to the details page of articles, products, and single pages, AnQiCMS also allows you to deeply customize the display template of category pages, which is crucial for displaying list content.

Each content model has a default list page template, usually{模型table}/list.htmlfor examplearchive/list.htmlorproduct/list.html)

If you wish to display the article list under a specific category (such as "News Centernews-list-template.html.

Further, AnQiCMS allows you to create a named category for specific categories{模型table}/list-{分类id}.htmlsuch asarchive/list-5.htmlThe file will be automatically applied to the article category with ID 5."),

It is worth mentioning that there is also a "document template" field and the option of "whether to apply to subcategories" in the category settings.This means that you can not only customize the list page template for the category itself, but also specify a detailed page template for all articles/products under the category and its subcategories, which greatly simplifies the management of multi-level content and style uniformity.

You can use it in the category template,{% categoryDetail %}Label to obtain the details of the current category, such as{{category.Title}}/{{category.Description}}. To display the list of articles or products under the category, you need to use{% archiveList %}Label, and throughcategoryIdparameter to specify which category's content to list, combined withtype="page"and{% pagination %}The label can easily implement pagination.

The organization and filling of the template file.

The template file organization of AnQiCMS is very flexible, you can choose the "folder organization mode" or the "flattened file organization mode". For example, in folder mode, you can place the article detail page inarchive/detail.htmland the single page detail page is placed inpage/detail.html.

The core of any organizational mode chosen is to use various template tags provided by AnQiCMS to fill in the content. In addition to the aforementionedarchiveDetail/pageDetail/categoryDetailAnd `archiveList`

Related articles

How to use the `archiveParams` tag to retrieve and display the content of the custom parameter fields of the document?

In daily website operations, we often encounter the need that standardized content fields can no longer meet the diversified display of information.For example, a product detail page may need to display unique attributes such as "model", "material", "warranty period", etc., while a regular article may need additional notes such as "source of the article", "estimated reading time", etc.

2025-11-08

How to dynamically generate and display SEO titles, keywords, and descriptions for `tdk` tags on different pages?

In website operation, the title (Title), keywords (Keywords), and description (Description), known as TDK, are indispensable core elements of search engine optimization (SEO).They not only directly affect the display of the website on the search engine results page (SERP), but also determine whether users click to enter your website.

2025-11-08

What global website information and contact details can the `system` tag and `contact` tag retrieve and display?

In the daily operation of AnQiCMS, the global information and contact information of the website are highly concerned by users and frequently change.How to efficiently and uniformly manage and display this information is an important standard for measuring the flexibility of a content management system.AnQiCMS provides an extremely convenient solution for calling website content and contact information through its unique template tag system, especially the core tags `system` and `contact`.

2025-11-08

How is the `bannerList` tag used to fetch and display the carousel of the website homepage or a specific group?

When building modern websites, the banner carousel is a commonly used element to enhance visual appeal and convey important information.They are usually located in prominent positions on websites, such as the top of the homepage, to display the latest activities, featured products, or important announcements.In AnQiCMS (AnQiCMS), managing and displaying these carousel images becomes very convenient, mainly due to its powerful template tag system, especially the `bannerList` tag.`bannerList`

2025-11-08

How to display custom fields defined in the AnQiCMS content model on the front end?

AnQiCMS's flexible content model is one of its core advantages, allowing us to define unique fields for different types of content according to actual business needs, thereby freeing ourselves from the limitations of traditional CMS fixed content structure.When we create these custom fields, the next critical step is to display them elegantly on the website frontend.This article will introduce you in detail how to define custom fields in the AnQiCMS backend, as well as how to flexibly call and display this information in the frontend template, making your website content more personalized and practical.### One

2025-11-08

How does AnQiCMS implement the switch of multilingual content and correct display?

In order to meet the content operation needs of globalization, it is a key step to enable your website to support multi-language content switching and correct display, expanding the market and enhancing user experience.AnQiCMS (AnQiCMS) is a feature-rich content management system that provides an intuitive and powerful multilingual solution, helping you easily meet this challenge.Next, we will discuss in detail how to achieve this goal in AnQiCMS.

2025-11-08

How to dynamically display the 'recommended properties' (such as headlines, recommendations) of articles or products on a page?

When operating website content, we often need to make special recommendations for certain articles or products, such as 'headline', 'hot', or 'recommended', etc., in order to display them more prominently on the page and guide users' attention.AnQiCMS provides a very flexible "recommendation attribute" feature, allowing you to easily achieve this.Let's take a look together at how to set these properties in AnQiCMS and dynamically display them on your website.

2025-11-08

What thumbnail processing methods does AnQiCMS support, and how to set them to optimize the display effect?

In website operation, image content plays a crucial role, especially exquisite thumbnails can quickly attract users' attention, enhance the visual beauty of the page, and improve the click-through rate.AnQiCMS (AnQiCMS) offers flexible and diverse functions in image processing, especially for thumbnail generation and optimization, aiming to help websites achieve **display effects.We will delve into the thumbnail processing methods supported by AnQiCMS, as well as how to make your website images come to life through reasonable settings.### The core mechanism of AnQiCMS thumbnail processing First

2025-11-08