As website operators, we all hope that our website content can be presented to visitors in the most attractive way.This is not just about visual beauty, but also about how the content structure better serves users and how to highlight the unique brand character of the website.AnQiCMS understands this need and therefore provides a powerful and flexible template configuration function in the background, allowing you to achieve highly personalized display according to different content types - whether it is articles, products, or category pages.
Below, let's learn together how to configure the category template and document template on the AnQiCMS backend, giving your content a unique display style.
The operation mechanism of AnQiCMS templates
Before delving into the configuration, let's first understand the AnQiCMS template system.AnQiCMS uses a syntax similar to the Django template engine, which means you can control page layout and data entry through concise tags.All template files are stored in/templateIn the directory, in the theme folder you have selected, usually with.htmlWith 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 grants you great freedom to customize the content structure according to your business needs.
AnQiCMS content management is built based on the '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 is also centered around these models to achieve fine-grained content control.
Configure category templates: Define the display method of the content list
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 through category template configuration.
To configure the category template, you need to go to the AnQiCMS backend, find the "Content Management" menu on the left, and then click "Document Category."}Here, you can manage all content categories. Select the category you want to configure (such as "News Update" or "Company Products"), click the "Edit" button on the right.
In the "Other Parameters" section of the category editing page, you will see an input box named "Category Template."}This is where you can demonstrate your personalized layout. AnQiCMS defaults to providing a generic list template based on the content model, for examplearticle/list.html(Article model) orproduct/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 examplearticle/news-list.htmlorproduct/fancy-gallery.html.
Moreover, there is also an option below to apply it to subcategories.Tick it, all subcategories under the current category will inherit and use this custom category template you set, which is very useful for maintaining the consistency of content structure.Of course, if the sub-categories need a more special display, you can also configure templates for them separately.
Configure document template: Customize detail pages for each piece of content
In addition to the category list, each specific content (whether it's an article or a product) may also require a unique detail page layout. AnQiCMS provides two ways to configure document templates, allowing you to be flexible:
1. To specify a uniform template for all documents under the entire category
When you edit the category, you will also see a 'Document Template' option in the 'Other Parameters' section, in addition to the 'Category Template'. This setting allows you to select a template for the current category under theAll documentsSpecify a unified detail page template. For example, you can specify a template with code highlighting for the "Technical Articles" category, while the "Case Studies" category may require a template that emphasizes images and citation blocks.Enter asarticle/tech-detail.htmlSuch a template filename, all document detail pages in this category will use this template.
2. Configure a dedicated template for a single document
Sometimes, an important article or a featured product needs 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 in the "Content Management" section of the background to "Add Document" or "Edit Document", you will find an input box for the "Document Template".Here, you can specify a completely independent template for the specific document you are currently editing.For example, you can specify for a year-end reportarticle/annual-report.htmlOr specify for a new product release page.product/launch-special.html. Once set, the detail 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 like "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" and "Page Management".Find the 'Single Page Template' option in the 'Other Parameters'.Here, you can specify a 'About Us' page forpage/about-us.htmlThe template, making it stand out throughout the website.
Make the template file truly effective: Create with data calling.
It is not enough to specify the template file name in the background, you need to create the corresponding one in the theme directory of the website.htmlFor example, if you have specified in the backgroundarticle/news-list.htmlAs a template for a certain article category, you need to be in `/template/Your topic name/