In AnQi CMS, in order to make your website content more personalized and visually appealing, you can set exclusive display templates for different types of articles, product detail pages, or independent single pages.This not only improves the user experience, but also makes it convenient for you to operate content differently.AnQi CMS provides a flexible mechanism to achieve this goal, whether it is for all content under a certain category, a specific article or product, or an independent page, you can find a suitable template customization solution.

Overview of AnQi CMS template mechanism

The AnQi CMS template system is very flexible, allowing you to configure different display methods for content according to your actual needs. This customization is mainly reflected in two levels:

  1. Global or Category Inheritance:You can set a default template for the entire content model (such as an article model, product model) or a specific category.All content items under this category will follow this setting if not individually specified.
  2. 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 catering to the personalized needs of specific content.

Customize article and product templates

Articles and products are both categorized as "documents" in Anqi CMS, and their template setting 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:Enter the Anqi CMS backend and navigate to“Content Management”-u003e“Document Management”. Find the article or product you want to customize, click edit. In the "Other Parameters" collapsible area on the editing page, you will see a name called“Document Template”Input box.
  • How to fill in:Enter the template filename you have designed for this content, for exampledownload.html/event-promo.htmlorcustom-product-layout.html.
  • Location of the template file: Make sure the template file you entered exists in the template theme directory you are using, for example/template/您的主题名称/download.htmlIf the file does not exist, this content will not be displayed.

In this way, you can present an important promotional article, a featured product, or an event page with a completely different layout and style, attracting the attention of users.

2. Specify a template for all content under a certain category

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 styles (such as news center, successful cases).

  • Operation path:Enter the Anqi CMS backend and navigate to“Content Management”-u003e“Document Category”. Choose the category you want to configure, click edit. In the "Other Parameters" collapse area on the edit page, you will see two fields related to the template:
    • "Category Template":This field is for the category oflist page(For example, to display the page of all articles under this category) Set the template. If you want the list page of this category to have a unique design, you can fill it in here, for examplenews-list.html.
    • “Document Template”:This field is for the category belowAll document (article or product) detail pagesSet the template. Here you can enter a template filename, for examplenews-detail.htmlorproduct-detail-v2.html. All documents under this category (unless a template is specified separately) will use this template for display.
  • Apply to subcategories?:The category template and document template do not inherit to subcategories by default. But you can check the box toWhether to apply to subcategoriesOptions, let these template settings also affect all subcategories under the category. This is very convenient for maintaining a unified style in a multi-level category structure.
  • Location of the template file: 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

Single pages are usually used for independent and relatively fixed pages such as "About Us", "Contact Us", and "Service Introduction".Set them up with a dedicated template to better match the page function and brand image.

  • Operation path:Enter the Anqi CMS backend and navigate to"Page Resources"-u003e“Page Management”. Select the single page template you want to customize, click edit. In the edit page's 'Single Page Template' input box, you can specify the display template of the page.
  • How to fill in:Enter the template file name you designed for this single page, for exampleabout.html/contact-us.html.
  • Location of the template file: This file should be placed in the current theme ofpage/Under the directory (for example/template/您的主题名称/page/about.html),or directly in the root directory of the theme, but it is recommended to follow the convention and place it inpage/The catalog is to maintain organization.

The template files are stored and named according to conventions.

All your custom template files need to be placed in the theme folder you are currently using. For example, if your theme name isdefault, then the template file path may be similar to/template/default/.

The AnqiCMS supports some default naming conventions. If you name the template files according to these conventions, the system will automatically apply them without manual settings in the background:

  • Article/Product Detail Page: {模型table}/{文档id}.html(For example)article/10.htmlAutomatically applied to the article details with ID 10)
  • Article/Product List Page: {模型table}/list-{分类id}.html(For example)article/list-5.htmlAutomatically applied to the article category list with ID 5}
  • Single page detail page: page/{单页面id}.htmlorpage/{单页面别名}.html(For example)page/1.htmlorpage/about.html)

These conventions provide you with another quick customization method, especially suitable for scenarios where a high degree of customization is required for a small amount of specific content.

By using the above method, you can fully utilize the template customization capabilities of Anqi CMS to create a unique and feature-rich content display experience for your website.Whether it is the exclusive layout for each article or the unified style for a category, Anqi CMS can help you achieve it efficiently.


Frequently Asked Questions (FAQ)

  1. 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 AnQi CMS template mechanism follows the 'proximity principle'.The template specified for a specific piece of content has the highest priority, it will override the 'Document Template' set for its category.Therefore, your important article will display the individually specified template.

  2. Q: How do I create a new custom template file and place it in the theme directory, but it does not appear in the template selection dropdown list in the background, or the page cannot apply this template normally?A: Firstly, make sure that the suffix of your template file is.htmland the path is correct, for example/template/您的主题名称/您的模板文件.html. Secondly, you may need to check the template theme'sconfig.jsonIs the file recognized correctly. If everything looks normal but the problem persists, try clicking "System Upgrade" -> "Update Cache" in the Anqicms CMS background, clear the system cache and try again.

  3. Q: Can I apply the same custom template file to content under different content models? For example, a universal layout for some articles and some products?A: Yes, you can. As long as the template file itself is a communication