When using AnQiCMS to manage website content, we often encounter the need that all articles, products, or other documents under a specific category should use the same display template uniformly, rather than setting each document separately.This not only ensures the consistency of the website style, but also greatly improves the efficiency of content operation.AnQiCMS understands the pain points of users in this aspect and therefore provides a very flexible and intuitive way to meet this need.
Locate the target category
Firstly, we need to enter the AnQiCMS backend management interface and find the category we want to unify the template for.Generally, this would be located under the "Document Classification" page in the "Content Management" module.Here, you will see all the categories created, which are clearly arranged according to the structure level you set.
Find the target category you want to set in the category list, then click the 'Edit' button next to it to enter the detailed editing page of the category.
Configure the category-specific document template
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 in the category.
For example, if you have a "Company News" category and you want all the news in this category to use a name callednews_detail.htmlTo display details using a template, just fill in the 'Document Template' field here.news_detail.htmlThe same applies. If your 'Product Display' category needs a specificproduct_display.htmlTemplate, also set accordingly.
It should be specially reminded that the template file name you enter here must exist in the template package you are currently using (located in/template/您的模板目录/If the file does not exist, accessing the documents under the category may cause the page to fail to load.
Flexible application to subcategories
Immediately below the 'Document Template' setting, you will find a very practical option - 'Apply to Subcategories'.
By default, the document template you set for the current category will only take effect on the category itself.If you wish for this template to also be inherited and used by all subcategories under this category, please make sure to check this option.For example, you have set a uniform for the large category of "News Center"news_detail.htmlTemplate, and if you check the 'Apply to subcategories' option, then all the documents under 'News Center', such as 'Industry Dynamics', 'Company Announcements', and so on, will be automatically沿用news_detail.htmlDisplay it. This is very effective for constructing a website structure with a unified brand image or content style.
Save and verify changes.
After completing these settings, don't forget to click the 'Save' button at the bottom of the page to make your changes effective.After saving successfully, to ensure that the template update is immediately reflected on the website front end, we recommend that you go to the "Update Cache" feature in the background and clear the page cache of the website.
Finally, be sure to visit a few documents under this category on the front end to confirm that they are all displayed correctly according to the new template you specified.If everything goes well, then congrats, you have successfully specified a display template for all documents under a specific category!This approach can greatly simplify the content management process, ensure visual consistency of the website, enhance the user browsing experience, and improve your operational efficiency.
Frequently Asked Questions (FAQ)
1. If a document has also set a "document template" on its own editing page, which template will take effect, the unified template set in the category or the template set by the document itself?
In most cases, AnQiCMS follows the logic of 'proximity principle' and 'more specific priority'.This means that if a document specifies a template on its own editing page, then the settings for this single document have a higher priority and will override the template specified uniformly for its category.Only when the document itself has not set a template, the unified template specified in the category will take effect.
2. I should place the custom document template file (such asnews_detail.html) in which position in the website directory?
You need to place the template file you customized in the root directory of the AnQiCMS websitetemplateInside 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 directory. To organize the structure better, it is usually placedarticle/orproduct/in such subdirectories, for example/template/default/article/news_detail.html.
Can I set a document template uniformly for a category but want some special documents in that category to use a different template? Is it possible?
It is completely possible. As mentioned in the first question, the priority of the template setting for 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.