When using AnQiCMS to manage website content, we often encounter such needs: we hope that all articles, products, or other documents under a specific category can be uniformly displayed using the same template, rather than setting them individually for each document.This not only ensures the consistency of the website style, but also greatly improves the efficiency of content operation.AnQiCMS knows the pain points of users in this aspect and therefore provides a very flexible and intuitive way to meet this need.

定位目标分类

Firstly, we need to enter the AnQiCMS backend management interface, find the category of the unified template we want.This usually locates under the "Content Management" module and the "Document Category" page.Here, you will see all the categories created, clearly arranged in the structure hierarchy you set.

Find the target category you want to set in the category list, then click the "Edit" button next to it, and enter the detailed editing page of the category.

Configure the exclusive document template for the category

In the category editing page, scroll down until you see a setting item named "Document Template".This field is used to specify the display template for all documents under this category.

For example, if you have a "Company News" category and you want all news under this category to use a name callednews_detail.htmlThe template to display details, simply fill in the "Document Template" fieldnews_detail.htmlIf your "Product Display" category needs a specificproduct_display.htmlTemplate, set accordingly.

It should be particularly reminded that the template file name you enter here must be a real file existing in the template package you are currently using (/template/您的模板目录/)in it. If the file does not exist, accessing the documents under the category may cause the page to fail to load normally.

Flexible application to subcategories

Immediately below the "Document Template

By default, the document template you set for the current category will only apply to that category itself.If you want this template to be inherited and used by all subcategories under this category, please be sure to check this option.news_detail.htmlThe template is selected, and the option 'Apply to subcategories' is checked, then all subcategories under 'News Center', such as 'Industry Dynamics', 'Company Announcements', etc., will be automatically inherited.news_detail.htmlDisplay it. This is very effective for building a website structure with a unified brand image or content style.

Save and verify changes

Finally, be sure to access several documents under this category on the front end to confirm that they are displayed correctly according to the new template you specified.If everything goes well, then congratulations, you have successfully specified the display template for all documents under a specific category!This method can greatly simplify the content management process, ensure the visual consistency of the website, enhance the user browsing experience, and improve your operational efficiency.


Common Questions (FAQ)

1. If a document has a "Document Template" set separately on its editing page, which template will take effect: the one set uniformly in the category or the one set by the document itself?

In most cases, AnQiCMS will follow the logic of 'Proximity Principle' and 'More Specificity First'.This means that if a document explicitly specifies a template on its editing page, the priority of this setting for the individual document will be higher, and it will override the template specified uniformly for its category.Only when the document itself does not have a template set, the template specified in the category will take effect.

2. I should place the custom document template file (for examplenews_detail.html) in which position of the website directory?

You need to place your custom template file in the root directory of AnQiCMS website.templateIn the folder, specifically in the folder of the template theme you are currently using. For example, if your template theme is nameddefault, then the file should be placed in/template/default/In the catalog. It is usually placed to better organize the structurearticle/orproduct/in such subdirectories, for example/template/default/article/news_detail.html.

3. If I have set a document template for a category uniformly, but want some special documents in this category to use a different template, is it possible?

Absolutely.As described in the first question, the template setting priority of a single document is higher.You just need to edit those special documents, find the "Document Template" option on the editing page, and specify the required template file name for them separately.These special documents will use their own independent templates, while other documents in the category will continue to use the unified templates set.