In Anqi CMS, in order to make your website content more personalized and visually appealing, you can set dedicated display templates for different types of articles, product detail pages, or independent single pages.This not only improves the user experience, but also facilitates differentiated operations for specific content.AutoCMS provides a flexible mechanism to achieve this goal, whether it is for all content under a specific category, a specific article or product, or an independent page, a suitable template customization solution can be found.
AnQi CMS template mechanism overview
The template system design of Anqi CMS is very flexible, allowing you to configure different display methods for content according to your actual needs. This customization is mainly reflected in two aspects:
- Global or category inheritance:You can set a default template for the entire content model (such as article model, product model) or for a specific category.All items under this category will follow this setting if no separate template is specified.
- Independent content item specification:For a specific article, product, or standalone single-page, you can directly specify a unique template for it, thereby overriding the default settings of the parent (category or model).
This hierarchical template inheritance and overlay mechanism allows the display of content to maintain overall consistency while also accommodating the personalized needs of special content.
Custom articles and product templates
Articles and products are both categorized as "documents" in AnQi CMS. Their template settings logic is similar.
1. Specify a template for a specific article or product.
When you want a specific article or product to have a unique display page, you can set it directly in the editing interface.
- Operation path:Log in to the AnQi CMS backend, navigate to“Content Management”-“Document Management”Find the article or product you want to customize, click edit. In the "Other Parameters" collapsible area on the edit page, you will see a named"Document Template"the input box.
- How to fill in:Enter the filename you have designed for this content in this input box, for example
download.html/event-promo.htmlorcustom-product-layout.html. - Template file location:Make sure the template file you have entered exists in the current template theme directory you are using (for example
/template/您的主题名称/download.htmlIf the file does not exist, this content will not be displayed normally.
In this way, you can present an important promotional article, a featured product, or an event page with a completely different layout and style to attract the attention of users.
2. Specify a template for all content under a category in English
If you want all articles or products under a certain category to use the same display template regardless of the number, you can make a unified configuration in the category settings.This is very useful for creating special column programs with specific styles (such as news centers, successful cases).
- Operation path:Log in to the AnQi CMS backend, navigate to“Content Management”-Document ClassificationSelect the category you want to configure, click edit. In the "Other Parameters" collapse area on the editing page, you will see two fields related to the template.
- “Category Template”:This field is for the category ofList pageSet the template. If you want a unique design for the list page of this category, you can fill it in here, for example
news-list.html. - "Document Template":This field is for the category.All document (article or product) detail pages.Set the template. Here you can enter a template filename, such as.
news-detail.htmlorproduct-detail-v2.htmlAll documents in this category (unless a template is specified separately) will be displayed using this template.
- “Category Template”:This field is for the category ofList pageSet the template. If you want a unique design for the list page of this category, you can fill it in here, for example
- Apply to subcategories?The category template and document template will not be inherited to the subcategory by default. But you can check the box to“Is applied to subcategory”Options, let these template settings also apply to all subcategories under this category. This is very convenient for maintaining a unified style in multi-level category structures.
- Template file location:Similarly, these template files also need to be placed in the corresponding directory of the theme you are currently using (for example
/template/您的主题名称/news-list.htmlor/template/您的主题名称/news-detail.html).
Custom single page template
The single-page is usually used for independent pages with relatively fixed content such as 'About Us', 'Contact Us', 'Service Introduction', etc.Set dedicated templates for them can better match page functions and brand image.
- Operation path:Log in to the AnQi CMS backend, navigate to“Page Resources”-"Page Management"。Select the single page template you want to customize, click edit. In the 'Single Page Template' input box on the editing page, you can specify the display template for the page.
- How to fill in:Enter the filename you designed for this single page, for example
about.html/contact-us.html. - Template file location:This file should be placed in the theme you are currently using
page/directory (for example/template/您的主题名称/page/about.html),or placed directly in the theme's root directory, but it is recommended to follow the convention and place it inpage/The catalog is maintained for organization.
Template files are stored and named according to conventions.
All custom template files you create must be placed in the theme folder you have enabled. For example, if your theme name isdefaultThen the template file path may be similar to/template/default/.
The CMS supports some default naming conventions. If you name the template files according to these conventions, the system will automatically apply them without the need to manually set them in the background:
- Article/Product detail page:
{模型table}/{文档id}.html(For example}]}article/10.htmlWill be automatically applied to the article detail with ID 10) - Article/Product list page:
{模型table}/list-{分类id}.html(For example}]}article/list-5.htmlWill be automatically applied to the article category list with ID 5) - Single Page Details Page:
page/{单页面id}.htmlorpage/{单页面别名}.html(For example}]}page/1.htmlorpage/about.html)
These conventions provide you with another quick way to customize, especially suitable for scenarios that require high customization for a small amount of specific content.
By using the above method, you can fully utilize the template customization capability of the security CMS, creating a unique and feature-rich content display experience for your website.Whether it is a dedicated layout for each article or a unified style for a certain category, AnQi CMS can help you achieve it efficiently in English.
Common Questions (FAQ)
Q: I have set a "document template" for a category, but I have also specified a separate template for an important article. Which template will be displayed in the end?A: The template mechanism of AnQi CMS follows the 'nearest principle'.The template specified for a single piece of content has the highest priority, and it overrides the 'Document Template' set for its category.Therefore, your important article will display the template specified separately.
Q: How do I create a new custom template file and place it in the theme directory, but the template selection dropdown list in the backend does not display it, or the page cannot apply this template normally?A: Firstly, please ensure that the file extension of your template is
.html, and the path is correct, for example/template/您的主题名称/您的模板文件.html. Secondly, you may need to check the template theme'sconfig.jsonIs the file correctly identified.If everything looks normal but the problem persists, try clicking 'System Upgrade' -> 'Update Cache' in the AnQi CMS backend, clear the system cache and try again.Q: Can I apply the same custom template file to content under different content models? For example, a general layout for some articles and some products?A: Yes, you can. As long as the template file itself is a