As website operators, we all hope that our website content can be presented to visitors in the most attractive way.This is not just visual beauty, but also about how the content structure can better serve users, and how to highlight the unique brand characteristics of the website.AnQiCMS knows this need and therefore provides a powerful and flexible template configuration feature in the backend, allowing you to achieve highly personalized display according to different content types - whether it is articles, products, or category pages.
Below, let's get together to understand how to configure category templates and document templates in AnQiCMS backend, giving your content a unique display style.
AnQiCMS的模板运作机制 English
Before we delve into the configuration, let's briefly understand the template system of AnQiCMS.AnQiCMS uses a syntax similar to Django template engine, which means you can control the page layout and introduce data through concise tags./template目录下您所选用的主题文件夹中,通常以 English.htmlEnglish suffix.When you specify a template in the background, the system will go to this directory to find the corresponding file to render the page.This mechanism gives you a great degree of freedom to customize the content structure according to business needs.
The content management of AnQiCMS is built based on 'content model', such as article model, product model, etc.Each category and document belongs to a specific content model, and the configuration of the template revolves around these models, thereby achieving fine-grained content control.
配置分类模板:定义内容列表的呈现方式 English
Imagine that your "news center" needs a simple list layout, while the "product showcase" requires a product grid layout with thumbnails and prices.In AnQiCMS, you can easily achieve these differentiated displays by configuring the category template.
To configure the category template, you need to enter the AnQiCMS backend, find the "Content ManagementHere, you can manage all content categories.Select the category you want to configure (for example, "News and Updates" or "Company Products
On the category editing page, you will see an input box named "Category Template" in the "Other Parameters" section.This is the place where you can showcase your personalized layout.article/list.html(文章模型)或 Englishproduct/list.html(Product Model)。If you want to specify a unique list page for the current category, just enter the custom template filename in this input box, for example,article/news-list.htmlorproduct/fancy-gallery.html.
In addition, there is also an option below to 'Apply to Subcategories'.Check it, all the subcategories under the current category will inherit and use this custom category template you set, which is very useful for maintaining the consistency of the content structure.Of course, if you need a special display for the subcategories, you can also configure templates for them separately.
Configure document template: Customize detail pages for each content
In addition to the category list, each specific content (whether it is an article or a product) may also require a unique detail page layout. AnQiCMS provides two ways to configure document templates, allowing you to respond flexibly:
1. To specify a template for all documents under the entire category
When you edit the category, you will also see an option for "Document Template" in the "Other Parameters" section, in addition to the "Category Template". This setting allows you to set for the current category.All documentsSpecify a detail page template uniformly.For example, you can specify a template with a code highlighting area for the 'Technical Articles' category, while the 'Case Studies' category may require a template that is more focused on images and citation blocks.article/tech-detail.htmlSuch a template filename, all document details pages under this category will use this template.
2. Configure a dedicated template for a single document.
Sometimes, an important article or a featured product may need a completely unique showcase page, unrestricted by the default template of its category.AnQiCMS also considered this point.
When you scroll down to the 'Other Parameters' area while adding or editing a document in the 'Content Management' backend, you will find an input box for 'Document Template'.Here, you can specify a completely independent template for the specific document you are currently editing.article/annual-report.htmlOr specify for a new product release page.product/launch-special.htmlOnce set, the details page of this document will prioritize the use of this custom template, overriding the default settings of its category.
Single page template: flexible presentation of static content
For independent pages such as "About Us" and "Contact Information" that do not belong to any model category, AnQiCMS also provides similar template customization capabilities.You can edit a single page under 'Page Resources' -> 'Page Management'.Similarly, in the "Other Parameterspage/about-us.htmlThe template, making it stand out throughout the website.
Enable the template file to take effect: create and call the data.
The light in the background does not specify the template file name yet, you need to create the corresponding one in the theme directory of the website..htmlFor example, if you specify the file in the backgroundarticle/news-list.htmlAs a template for some article category, then you need to be in `/template/Your theme name/