How to set a dedicated display template for articles, products, or single pages in AnQi CMS?

Calendar 👁️ 73

In AnQi CMS, in order to make your website content more personalized and visually appealing, you can set exclusive display templates for different types of articles, product detail pages, or independent single pages.This not only improves the user experience, but also makes it convenient for you to operate content differently.AnQi CMS provides a flexible mechanism to achieve this goal, whether it is for all content under a certain category, a specific article or product, or an independent page, you can find a suitable template customization solution.

Overview of AnQi CMS template mechanism

The AnQi CMS template system is very flexible, allowing you to configure different display methods for content according to your actual needs. This customization is mainly reflected in two levels:

  1. Global or Category Inheritance:You can set a default template for the entire content model (such as an article model, product model) or a specific category.All content items under this category will follow this setting if not individually specified.
  2. Independent Content Item Specification:For a specific article, product, or standalone single-page, you can directly specify a unique template for it, thereby overriding the default settings of the parent (category or model).

This hierarchical template inheritance and overlay mechanism allows the display of content to maintain overall consistency while also catering to the personalized needs of specific content.

Customize article and product templates

Articles and products are both categorized as "documents" in Anqi CMS, and their template setting logic is similar.

1. Specify a template for a specific article or product.

When you want a specific article or product to have a unique display page, you can set it directly in the editing interface.

  • Operation path:Enter the Anqi CMS backend and navigate to“Content Management”-u003e“Document Management”. Find the article or product you want to customize, click edit. In the "Other Parameters" collapsible area on the editing page, you will see a name called“Document Template”Input box.
  • How to fill in:Enter the template filename you have designed for this content, for exampledownload.html/event-promo.htmlorcustom-product-layout.html.
  • Location of the template file: Make sure the template file you entered exists in the template theme directory you are using, for example/template/您的主题名称/download.htmlIf the file does not exist, this content will not be displayed.

In this way, you can present an important promotional article, a featured product, or an event page with a completely different layout and style, attracting the attention of users.

2. Specify a template for all content under a certain category

If you want all articles or products under a certain category to use the same display template regardless of the number, you can make a unified configuration in the category settings.This is very useful for creating special column styles (such as news center, successful cases).

  • Operation path:Enter the Anqi CMS backend and navigate to“Content Management”-u003e“Document Category”. Choose the category you want to configure, click edit. In the "Other Parameters" collapse area on the edit page, you will see two fields related to the template:
    • "Category Template":This field is for the category oflist page(For example, to display the page of all articles under this category) Set the template. If you want the list page of this category to have a unique design, you can fill it in here, for examplenews-list.html.
    • “Document Template”:This field is for the category belowAll document (article or product) detail pagesSet the template. Here you can enter a template filename, for examplenews-detail.htmlorproduct-detail-v2.html. All documents under this category (unless a template is specified separately) will use this template for display.
  • Apply to subcategories?:The category template and document template do not inherit to subcategories by default. But you can check the box toWhether to apply to subcategoriesOptions, let these template settings also affect all subcategories under the category. This is very convenient for maintaining a unified style in a multi-level category structure.
  • Location of the template file: Similarly, these template files also need to be placed in the corresponding directory of the theme you are currently using (for example/template/您的主题名称/news-list.htmlor/template/您的主题名称/news-detail.html)

Custom single page template

Single pages are usually used for independent and relatively fixed pages such as "About Us", "Contact Us", and "Service Introduction".Set them up with a dedicated template to better match the page function and brand image.

  • Operation path:Enter the Anqi CMS backend and navigate to"Page Resources"-u003e“Page Management”. Select the single page template you want to customize, click edit. In the edit page's 'Single Page Template' input box, you can specify the display template of the page.
  • How to fill in:Enter the template file name you designed for this single page, for exampleabout.html/contact-us.html.
  • Location of the template file: This file should be placed in the current theme ofpage/Under the directory (for example/template/您的主题名称/page/about.html),or directly in the root directory of the theme, but it is recommended to follow the convention and place it inpage/The catalog is to maintain organization.

The template files are stored and named according to conventions.

All your custom template files need to be placed in the theme folder you are currently using. For example, if your theme name isdefault, then the template file path may be similar to/template/default/.

The AnqiCMS supports some default naming conventions. If you name the template files according to these conventions, the system will automatically apply them without manual settings in the background:

  • Article/Product Detail Page: {模型table}/{文档id}.html(For example)article/10.htmlAutomatically applied to the article details with ID 10)
  • Article/Product List Page: {模型table}/list-{分类id}.html(For example)article/list-5.htmlAutomatically applied to the article category list with ID 5}
  • Single page detail page: page/{单页面id}.htmlorpage/{单页面别名}.html(For example)page/1.htmlorpage/about.html)

These conventions provide you with another quick customization method, especially suitable for scenarios where a high degree of customization is required for a small amount of specific content.

By using the above method, you can fully utilize the template customization capabilities of Anqi CMS to create a unique and feature-rich content display experience for your website.Whether it is the exclusive layout for each article or the unified style for a category, Anqi CMS can help you achieve it efficiently.


Frequently Asked Questions (FAQ)

  1. Q: I have set a "document template" for a category, but I have also specified a separate template for an important article. Which template will be displayed in the end?A: The AnQi CMS template mechanism follows the 'proximity principle'.The template specified for a specific piece of content has the highest priority, it will override the 'Document Template' set for its category.Therefore, your important article will display the individually specified template.

  2. Q: How do I create a new custom template file and place it in the theme directory, but it does not appear in the template selection dropdown list in the background, or the page cannot apply this template normally?A: Firstly, make sure that the suffix of your template file is.htmland the path is correct, for example/template/您的主题名称/您的模板文件.html. Secondly, you may need to check the template theme'sconfig.jsonIs the file recognized correctly. If everything looks normal but the problem persists, try clicking "System Upgrade" -> "Update Cache" in the Anqicms CMS background, clear the system cache and try again.

  3. Q: Can I apply the same custom template file to content under different content models? For example, a universal layout for some articles and some products?A: Yes, you can. As long as the template file itself is a communication

Related articles

How to customize the overall layout and display structure of the website front-end page in AnQi CMS?

## Flexible Mastery: How Anqi CMS Creates Personalized Website Front-end Layout and Display Structure In the digital age, the front-end design of a website is crucial for user experience and brand image.An efficient content management system that not only can easily manage content but also can flexibly customize the overall layout and display structure of the front-end page.AnQi CMS is well-versed in this, providing us with a powerful and intuitive toolkit that makes website customization accessible.

2025-11-08

How to display user group details, user avatar, username, and other personal information in the template?

In website operations, providing users with personalized experiences, enhancing community interaction, and clearly showcasing the rights and interests of different user groups is the key to improving user stickiness and website value.AnQiCMS as a powerful content management system, provides flexible template tags, allowing us to easily display users' personal information (such as username, avatar) and details of their user group on the front-end page.

2025-11-08

How to customize Json-LD structured data to enhance search engines' understanding and display of page content?

In today's highly competitive online environment, making website content stand out, being accurately understood by search engines, and presented in an attractive manner is a goal that every website operator diligently seeks.Among them, the structured data of Json-LD plays a vital role.

2025-11-08

How to retrieve and display custom contact information from the background in a template (such as phone, email, WeChat)?

In website operation, clearly displaying contact information is crucial for improving user experience and promoting business communication.Whether it is customer consultation, seeking support, or business cooperation, visitors hope to find and contact you quickly.AnQiCMS provides a convenient and efficient mechanism for you to centrally manage these contact information in the background, and dynamically display them in the website template without frequently modifying the code, which greatly improves the efficiency of website maintenance.### Contact Management in AnQiCMS On AnQiCMS backend

2025-11-08

What types of template display modes does AnQi CMS support (such as adaptive, code adaptation)?

How to ensure that the content is perfectly displayed on different devices when building a website is a problem that every operator needs to consider.A safe CMS knows this, therefore it provides various flexible template display modes to help us choose the most suitable website presentation method according to our actual needs. The template display mode of AnQi CMS mainly includes three types: adaptive, code adaptation, and independent PC + mobile site.Understand their respective features and application scenarios, which can help you better plan the user experience and SEO strategy of the website.

2025-11-08

How to ensure that template files do not display乱码 when displayed on the page in AnQi CMS?

When using AnQi CMS to manage website content, if you suddenly find that the text on the page becomes strange and turns into unreadable symbols, which is what we often call 'garbled code', it is undoubtedly very annoying.The root cause of page garbled characters is usually inconsistent file encoding and browser parsing encoding.In Anqi CMS, ensure that template files are displayed normally, avoid garbled text, and the key is to understand and correctly handle the encoding of template files.The AnQi CMS has specific requirements for the encoding of template files, it needs to use **UTF-8 encoding** uniformly

2025-11-08

How to get and dynamically display the website name, Logo, and copyright information through template tags?

In AnQiCMS, efficiently managing the core information of a website is the key to building a flexible and easy-to-maintain website.The website name, logo, and copyright statement are an important part of the brand image and legal statement, and they usually need to be consistent across multiple pages of the website.AnqiCMS's powerful template tag system, especially the `system` tag, provides us with a concise and effective way to dynamically retrieve and display this information, greatly enhancing the development efficiency and maintenance convenience of the website.### Understand `system`

2025-11-08

How to implement multi-language content switching and correct display for different users in AnQi CMS?

Today, with the deepening of globalization, companies and content operators often need to reach users from different language backgrounds.An efficient content management system that can simplify the publishing and management of multilingual content will undoubtedly greatly enhance operational efficiency.AnQiCMS (AnQiCMS) provides a very practical solution at this point, helping users easily switch between languages and display content correctly.### The core concept of AnQiCMS building multilingual websites AnQiCMS regards multilingual support as one of its core features, aiming to help enterprises expand into the international market

2025-11-08