When managing our website content, we often encounter situations where we want articles in a specific category to be presented in a unique layout or style, distinguishing them from the standard display of other parts of the website.For example, product showcase articles may need to include detailed parameter tables and multi-image carousels, while blog articles focus on smooth reading experience and comment sections.AnQi CMS understands the importance of this personalized demand and provides a very flexible and intuitive way to achieve this, that is, to apply unique document display templates for specific categories.

To understand this feature, we first need to understand the template mechanism of Anq CMS. It uses a syntax similar to the Django template engine, and our web pages are all stored in/templateUnder the directory.htmlThe file is built. By default, the system provides a set of generic template files for different content types, such as article lists, product details, or single pages, for example.{模型table}/list.htmlUsed for category lists,{模型table}/detail.htmlUsed for document details. These default templates work well in most cases, but when you have special display requirements, the powerful customization capabilities of Anqi CMS come into play.

How to customize a dedicated template for a specific category

The entire process can be divided into two main steps: preparing the template file and configuring it in the background, which is very smooth.

1. Prepare your dedicated template file

The first step is to create or modify a file in your template folder.htmlas the display template for a specific category. Suppose you are using a file nameddefaultThe template theme, then this file will be placed in/template/default/directory.

File naming can be determined according to your preference, but it is recommended that the name clearly reflect its purpose, for example, if you want to create a unique list page for the category of "Special Offers", you can name itactivity-special-list.html. If you want each article in this category to have a special detail page, you can createactivity-special-detail.html.

In this new template file, you can freely design the layout, introduce specific CSS styles or JavaScript scripts. In terms of content calls, you can still use the various template tags provided by Anqi CMS to display data, such as{% categoryDetail %}Get the details of the current category or{% archiveList %}List the documents under this category. This way, you have complete control while still enjoying the convenience of the system automatically processing data.

2. Specify the template for categories in the backend

After the template file is ready, the next step is to inform the Anqi CMS which category should use this new template.

  • First, log in to the Anqi CMS backend management interface and navigate toContent ManagementArea, then click to enterDocument Category.
  • Here, you can select an existing category to edit or create a new category.
  • After entering the category editing page, you will see a field named "Category Template", which is usually located in the collapsed area of "Other Parameters".
  • In the 'category template' input box, you need to enter the name of the template file you just created. Please note that you only need to enter the file name, for example,activity-special-list.htmlDo not fill in the complete path (the system will automatically search in the current template theme folder).
  • After you submit and save the category information, this category page will start using the custom template you specified.

A particularly considerate feature is the option 'Apply to subcategories'.If you want all the subcategories under a certain category to follow this unique template style, just check this option when setting the parent category template.This way, you do not need to set each subcategory separately, which greatly improves management efficiency and also ensures the consistency of content presentation.

Why is this feature so practical?

The ability to apply unique templates to specific categories, which can bring many conveniences in actual operation:

  • Differentiated content marketing:For different types of content (such as news, products, case studies), you can design different layouts to highlight their core selling points, thereby attracting visitors and improving conversion rates.
  • Optimizing user experience: Professional event topic pages, clear product comparison pages, immersive blog reading pages, all can be realized through customized templates, providing users with a browsing experience that meets their expectations.
  • Enhance brand image:A unified and professional page style helps to enhance brand recognition. Even within the same website, different types of special content can have exclusive visual presentations, showcasing professionalism.
  • Adapt to operational needs:Whether it is a short-term promotional activity or special content that needs to be displayed for a long time, it can be quickly customized and applied without modifying the core code, which reduces the maintenance cost and technical threshold.

In short, this feature of AnQi CMS gives us great creative freedom.It no longer makes our website content monotonous, but can flexibly 'put on' the most suitable 'clothing' according to the characteristics of the content and the operation objectives, thus better serving our business objectives.


Frequently Asked Questions (FAQ)

1. Can I apply an independent display template to a specific single article?

Of course you can.AnQi CMS provides similar functions to handle a single article.my-download-article.htmlAfter saving, the article will be displayed in a unique style.

2. What will happen if the custom template file I entered does not exist?

If AnQi CMS cannot find the specified custom template file in your theme template folder, the category or document will not open normally, and error messages will usually be displayed.Therefore, before configuring in the background, please make sure that your template file has been uploaded and named correctly.

3. After applying the custom template, the content on the category page will call tags (such asarchiveListCan it still be used?

Absolutely. The custom template only changes the structure and style of the page, and the powerful data calling mechanism within Anqi CMS is still effective. You can continue to use it in the custom template.{% archiveList %}/{% categoryDetail %}Etc. tags to retrieve and display the required data, as in the default template. This ensures that you enjoy the freedom of design without losing the convenience of the system's core functions.