How to customize independent display templates for different categories or single pages?

Calendar 👁️ 61

In website operation, we often hope to design unique display styles for different content types or specific pages.For example, a news article may require a concise and clear list style, while a product introduction may place more emphasis on images and detailed parameters;The "About Us" page often requires a separate design to reflect the brand image.AnQiCMS (AnQiCMS) understands the importance of these personalized needs, providing flexible template customization features that allow you to easily create a unique visual experience for different parts of the website without delving into code.

AnQi CMS is developed based on Go language, and its template engine adopts syntax similar to Django, making the creation and modification of templates very intuitive and efficient.It not only supports various modes such as adaptive, code adaptation, and independent sites for PC and mobile, but more importantly, it allows us to specify a completely different display template for specific categories, single pages, or even individual documents, thereby greatly enhancing the display and operational flexibility of website content.

How exactly should one operate to customize independent display templates for different categories or pages on a website? In fact, the whole process is very simple, mainly focusing onPrepare the template fileAndspecified application in the backgroundThese two core steps expand.

Step 1: Customize a dedicated template for website classification

Imagine that your website has news categories, product display categories, and even case sharing categories.Each category has different content features and user focus points, naturally requiring different layouts to optimize user experience.The Anqi CMS allows you to specify an independent list page template for any category.

Operation steps:

  1. Create or select a template file: First, you need to create a new HTML file under the current template theme directory, as the exclusive template for this category. For example, if you want to design a grid layout for a product category, you can create a file namedproduct/grid_list.htmlThe file(productIs the model table name belonging to the category, usually justarticleorproduct)。This file will contain all the HTML structures and data call logic that you want the category list page to display.
  2. Apply template in the background:Log in to the AnQi CMS backend, navigate to the 'Content Management' module under 'Document Categories'.Find the category you want to customize the template, click “Edit”.In the "Other Parameters" section of the editing page, you will see a field named "Category Template".Here, simply enter the relative path and name of the template file you just created, for exampleproduct/grid_list.htmlPlease note that the main template directory name does not need to be included, the system will automatically identify it.
  3. Inheritance rules:If you wish to apply this custom template to all subcategories under the current category, you can find the option 'Apply to subcategories' below the 'Category template' field and check it.Otherwise, the subcategory will continue to follow the parent category or the default template of the model.
  4. Default naming convention:It is interesting that AnQi CMS also provides a convenient default naming convention. If you name the template file as{模型table}/list-{分类ID}.htmlfor examplearticle/list-10.htmlThen this template will be automatically recognized and applied to the article category with ID 10, saving the extra backend configuration steps.

In this way, you can display your product categories with exquisite grid images, while the news category maintains the traditional title list, with each section exuding professionalism.

Chapter 2, specify an independent template for a single document

Not all articles or product detail pages are suitable for a unified template.Certain special documents, such as software download pages, important thematic reports, or detailed product specification comparison pages may require a more unique layout.

Operation steps:

  1. Prepare an independent template: Likewise, you need to prepare a separate template file for this special document. For example, a software download page can create aarchive/download_page.htmlthe file (archiveis usually the default model table name for the article model)
  2. Specify in the background:In AnQi CMS backend, go to 'Content Management' -> 'Publish Document' or 'Edit Document'.In the "Other Parameters" area of the document editing page, find the "Document Template" field.Enter the name of your custom template file, for examplearchive/download_page.html.
  3. Model table naming convention:Similar to categories, documents also support default naming conventions. If you name the template file as{模型table}/{文档ID}.htmlfor examplearticle/123.html), then the article with ID 123 will automatically apply this template without the need for manual settings.

This feature allows operation personnel to target the optimization of the display effect of each key content, whether for higher conversion rates or better reading experience.

Three, to customize the display template for a specific single-page

For pages like "About Us", "Contact Information", and "Terms of Service" that are independent and usually contain little content, a unique layout can better convey brand information or guide users to complete specific actions.

Operation steps:

  1. Create a single page template:Create an HTML file for this single page under your theme directory. For example, create one for the "About Us" page.page/about_us.html.
  2. Back-end association: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 'Single Page Template' field on the editing page, enter the name of the template file you created, for examplepage/about_us.html.
  3. Default naming convention:The single page also supports the default naming rule, you can name the template.page/{单页ID}.htmlfor examplepage/5.html),the system will automatically apply this template to the single page with ID 5.

This high degree of customization makes your website stand out from the crowd, every corner exuding a unique charm.

Tips for storing and naming template files:

When customizing templates, the storage location and naming method of the template files are crucial. All template files should be placed in/templatethe directory of the theme you are using (for example/template/default/Fill in the template name in the background, just the path and filename relative to the theme directory, for examplearticle/detail.htmlorpage/my_custom_page.html.

Good file organization habits can make your template management clearer, for example, placing article-related templates inarticle/folders, and product-related ones inproduct/Under the folder. Moreover, by using the powerful template tag function of Anqi CMS, you can flexibly call various data of the website in custom templates to achieve rich and diverse content display.

With these features, AnQi CMS not only provides an efficient content management backend, but also gives you complete control over the website front-end presentation, making your website stand out among its peers.


Frequently Asked Questions (FAQ)

Q1: The custom template file should be placed in which directory of AnQi CMS?A1: You need to place the custom template file in the root directory of AnQi CMS./templateInside the folder, then enter the directory of the current theme template you are using (for example/template/default/). Under the theme directory, you can create subdirectories based on file type (for examplearticle//product//page/),put the corresponding custom template file in it.

Q2: If I set a custom category template, will the document detail page under this category automatically use this template?A2: No. Custom 'category template' only affects the list page display of the category.The document detail page has an independent "document template" setting. If you want all document detail pages under a certain category to use the same custom template, you need to find the "document template" field in the edit page of that category, or specify it separately in the edit page of each document.

Q3: Do you need to include.htmlthe suffix?A3: Yes, when filling in the template name in the background, you need to include the complete.htmla suffix, for examplearticle/my_special_list.htmlMake sure the path is relative to the current theme template directory.

Related articles

How to reuse header, footer, and other common modules in AnQiCMS templates to display content?

During the process of website construction, headers, footers, navigation bars, and other common modules are almost indispensable on each page.If each time these codes are manually written, it is not only inefficient but also difficult to ensure the consistency of the overall style of the website, and the subsequent maintenance work will become particularly cumbersome.AnQiCMS as an efficient content management system, its powerful template engine provides a variety of flexible ways to reuse these common modules, thereby greatly enhancing the efficiency of template development and the maintainability of the website.### The Way of Reusing Common Modules in AnQiCMS Template First

2025-11-08

How to improve the website content loading speed and user display experience through static caching mechanism?

On the day when digital content is thriving, the loading speed of a website directly affects the first impression and the time users spend on it, and even plays a crucial role in search engine rankings.A fast-loading website can significantly improve user experience, making visitors feel smooth and professional.For a high-efficiency enterprise-level content management system like AnQiCMS, ensuring rapid content loading and providing an excellent user experience is its core value.The static cache mechanism is the key tool to achieve this goal.What is static cache and why is it so important

2025-11-08

How does the modular design of AnQiCMS support personalized customization and secondary development of content display?

AnQiCMS with its exquisite modular design, provides users with broad space and strong support for personalized content display customization and secondary development.This not only reflects in the richness of its features, but also lies in the flexibility and openness of its underlying architecture, allowing each component of the website to be adjusted as needed and independently evolve. ### Modular Design: The Foundation of Flexibility and Efficiency Firstly, understanding the modular design of AnQiCMS is crucial. It breaks the entire system down into independent yet collaborative 'building blocks'.Each functional module (such as content model, template engine

2025-11-08

How does AnQiCMS ensure the stable display of content under high concurrency?

In a surge of internet traffic, whether a website can stably and smoothly display content is a key measure of its user experience and operational efficiency.Faced with the sudden challenge of high concurrency access, many content management systems often struggle, leading to slow page loading and even service interruption.However, AnQiCMS (AnQiCMS) has successfully provided a reliable solution in this field with its unique high-performance architecture design, ensuring that content can still be stable and fast under high concurrency.### The Concurrency Gene of Go Language: The Foundation of High Performance AnQiCMS

2025-11-08

What template types does AnQiCMS support to adapt to the display of content on different devices?

In today's digital world, users access websites through various devices, which has become the norm.From wide PC monitors to palm-sized smartphones, how to present website content seamlessly and efficiently is a challenge that every operator must face.AnQiCMS deeply understands this, providing users with a variety of flexible template adaptation strategies to ensure that your website can display the effect on different devices.AnQiCMS mainly supports three template types to adapt to the content display of different devices, each type has its unique application scenarios and advantages, and you can choose according to your own business needs and operational strategy

2025-11-08

How can we design and display a separate content template for mobile devices to optimize the mobile user experience?

It is crucial to optimize the mobile user experience for modern website operations, and designing content templates specifically for mobile devices is an efficient way to achieve this goal.AnQi CMS provides a flexible mechanism, allowing users to provide the most suitable browsing experience for different terminals according to their needs.### Understanding AnQi CMS Mobile Template Mode AnQi CMS is designed to meet the diverse mobile adaptation needs and includes three main website modes that determine how content is displayed to mobile users: * **Responsive Template Type**

2025-11-08

What is the default template file name for the document detail page and list page?

When using AnQiCMS for website building and content management, understanding the naming conventions of its template files is crucial for customizing and optimizing the website appearance.AnQi CMS to simplify template management, provides a flexible and default recognition naming convention, allowing website developers and operators to work more efficiently.First, all template files should be unified to use the `.html` suffix and placed in the `/template` folder under the website root directory.the styles and JavaScript scripts used in the template

2025-11-08

How to customize a dedicated content display template for a specific document ID or category ID?

In website operations, we often encounter such needs: a particular product display page needs a unique layout to emphasize its features, or an important event special page needs special design to attract users, or a "About Us" single-page site wants to show a different brand character.Anqi CMS provides us with a flexible way, allowing us to customize exclusive display templates for these unique content needs, thus greatly enhancing the visual appeal and user experience of the website.The Anqi CMS template system has adopted the Django template engine syntax

2025-11-08