How to customize independent display templates for specific content on the AnQiCMS website (such as documents, categories, single pages)?

Calendar 👁️ 74

In website operation, we often encounter scenarios where we need to give a unique "face" to specific content.It may be a "About Us" page carrying important information, needing a unique layout;It could also be a series of product details, hoping to show unique parameter comparisons;Even a content category, looking forward to presenting the list in a more attractive way.AnQiCMS (AnQiCMS) fully understands the need for refined content display and therefore provides a flexible and powerful template customization mechanism, allowing us to tailor exclusive display templates for documents, categories, and single pages.

AnQi CMS template mechanism overview

The AnQi CMS template system is developed based on Go language, adopting syntax similar to the Django template engine, which makes template creation both intuitive and efficient. All template files are in the form of.htmlwith suffix, and stored uniformly in/templateIn the directory. The accompanying styles, JavaScript scripts, and static resources such as images will be placed in/public/static/In the catalog.

In the absence of any special specification, Anqi CMS will match templates based on a set of default naming rules: for example, the document detail page may be used by default{模型table}/detail.html, for the category list page{模型table}/list.html, Single page detail usagepage/detail.htmlHowever, when these default templates fail to meet personalized needs, the function of custom independent templates becomes particularly important.

Customize an independent display template for specific content

The core of a custom template lies in 'specifying a specific template file for specific content'. This process is usually divided into two steps:Create a template fileandSpecify the template in the background.

1. Customize the template for the single page

Imagine that your website has a 'Company Profile' page, which may need a layout that includes unique design elements, large text illustrations, or special forms, which is completely different from regular news articles or product detail pages.

How to operate:First, you need to be in the directory of the template you are currently using (for example,template/default/),Create a new HTML file to host the exclusive layout of this single-page. For example, if you want to create a custom template for the "Company Profile" page, you can name itpage/company_profile.html.

Next, log in to the AnQi CMS backend, go to "Page Resources" under "Page Management".Find the single page you want to customize, click edit.In the "Other Parameters" section of the editing page, you will find a field named "Single Page Template".Enter the name of the template file you just created (only the file name and relative path), for examplecompany_profile.htmlAfter saving, when the user visits this "Company Profile" page, the Anqi CMS will automatically load and use the one you specified.page/company_profile.htmltemplate to display the content.

2. Customize templates for documents (articles, products, etc.)

For certain types of articles or products, personalized templates can also bring great value.For example, an in-depth technical analysis article may require special code highlighting areas, or a product introduction page that needs to display a large number of images, and it is hoped that there will be a carousel and a detailed parameter comparison table.

How to operate:Similar to a single page, you need to be in the template directory, according to the content model (for example, the article model usually correspondsarticleto the folder, the product model correspondsproductCreate a new template file. For example, you can create aarticle/technical_report.htmlused to display technical reports, orproduct/photo_gallery.htmlused to display product image galleries.

Then, in the background "Content Management" section, find and edit the document you want to apply this custom template to.In the "Other Parameters" section of the editing page, you will see a "Document Template" field.Enter the name of the template file you created, for exampletechnical_report.htmlorphoto_gallery.htmlAfter saving, when the user accesses this document, the system will load the dedicated template you specified.

It is worth mentioning that AnQi CMS also supports customization of templates for categories.Document CategoryThe level specifies the default template for all documents under the entire category. If you want all documents under a certain category (such as the "Software Download" category) to use a unified custom layout (such as including download buttons, version information, etc.), you can find the "Document Template" field on the edit page of that category and fill it out. This way, all documents under that category do not need to be set individually.

3. Customize templates for categories.

The category page is usually the entry point for users to browse content, and its display form often requires stronger design sense and guidance.For example, a "news center" category may need to be presented in a concise news list style, while a "success stories" category may need a large image and card layout to highlight visual impact.

How to operate:To customize the display template for categories, you also need to create the corresponding HTML file in the template directory. The default category list template is usually{模型table}/list.html. To customize, you can create a new template file in the corresponding model folder, for exampleproduct/list-showcase.html, used to display the category list of selected products.

Continue, in the background "Content Management" -> "Document Category", find and edit the category you want to customize the template for. In the "Other Parameters", find the "Category Template" field, enter the name of the template file you created, for examplelist-showcase.html.

In addition, if you want this custom category template to apply to all its subcategories, you can check the 'Apply to Subcategories' option in the same area, which can save the trouble of setting each subcategory one by one, ensuring the visual consistency of the entire category system.

Practical Tips and **Practice**

  • Clear naming conventions:Choose a meaningful filename for your custom template, for examplepage-about-us.html、`article-download.html

Related articles

How does AnQiCMS's adaptive, code adaptation, and PC+Mobile independent mode affect the display effect of the website on different devices?

In today's multi-screen interconnected era, whether a website can display smoothly and efficiently on different devices is directly related to user experience and brand image.AnQiCMS is a rich-featured enterprise-level content management system that fully understands this, providing users with three flexible website display modes to meet the diverse needs of device access: adaptive, code adaptation, and PC+Mobile independent mode.Understanding the working principles and their impact on the display effects of websites is crucial for operators.

2025-11-08

How to ensure UTF-8 encoding when creating AnQiCMS templates to avoid garbled front-end pages?

When using AnQiCMS to build a website, ensure that the front-end pages display normally and avoid annoying garbled characters, which is an important detail that every operator needs to pay attention to.Where, the character encoding of the template file is a key point.If the encoding setting of the template file is incorrect, even if the content of the website itself is not a problem, the page that ultimately appears to the user may be a bunch of unrecognizable characters.

2025-11-08

How to use the Go language features of AnQiCMS to implement the rapid loading and smooth display of website front-end content?

In today's rapidly changing digital age, the loading speed of websites and the smooth display of content have become key indicators of user experience and SEO performance.AnQiCMS (AnQiCMS) leverages its powerful genes based on the Go language to provide solid technical support for the rapid loading and smooth display of website front-end content.Go language is renowned for its exceptional performance and concurrent processing capabilities.As a compiled language, Go code is efficiently converted into machine code before execution, which means the program has extremely high execution efficiency.

2025-11-08

How does the modular design of AnQiCMS support the independent upgrade and display expansion of front-end feature points?

AnQiCMS is favored in the field of website operation largely due to its exquisite modular design.This design not only makes the system itself efficient and stable, but more importantly, it provides powerful and flexible support for the independent upgrade and display expansion of front-end feature points, allowing content operators to have more freedom to control the presentation style and development path of the website.

2025-11-08

How to accurately control the display quantity, sorting, and filtering conditions of the `archiveList` tag?

In Anqi CMS, the `archiveList` tag is a core tool for dynamically calling and displaying document lists.Whether it is a blog article, product showcase, or news update, this tag can help you flexibly control the display quantity, sorting method, and various filtering conditions according to your specific needs.A deep understanding of its parameters will enable you to build a highly customized and powerful content display page.

2025-11-08

How to use the `archiveDetail` tag to retrieve and fully display the title, content, and custom fields of a specific document?

In AnQiCMS, displaying the detailed content of a single document is one of the core requirements for website construction.Whether it is an article detail page, a product detail page, or other custom type of content display, we need a flexible and efficient way to obtain and present the title, body of the document, and custom fields defined according to business requirements.The `archiveDetail` tag was born for this purpose, it can help you easily achieve this goal.### Deeply understand the `archiveDetail` tag

2025-11-08

How do the `prevArchive` and `nextArchive` tags display the link and title of the previous/next document on the document detail page?

When we browse content on the website built with AnQiCMS, carefully crafted documents bring value to readers.It is particularly important to provide 'Previous' and 'Next' navigation links at the end of each article to make the reader's reading experience more smooth and encourage them to explore more relevant content.This can effectively guide users to deeply browse within the website, increase page visits and user stickiness, and is also very beneficial for the internal link structure and SEO optimization of the website.

2025-11-08

How to use the `categoryList` tag to build a multi-level category navigation or display category lists in the content area?

In Anqi CMS, properly organizing website content categories is an important aspect for improving user experience and website maintainability.Whether it is to build a clear multi-level navigation menu, help users quickly locate information, or skillfully display different categories of content in the page content area, the `categoryList` tag is the core tool for realizing these functions. ### Core Tag: `categoryList` Description The `categoryList` tag is used specifically in the Anqi CMS template engine to retrieve the website category list.

2025-11-08