In AnQiCMS, in order to make your website more personalized and flexible, you can apply independent template files to specific content categories, single pages, or even single articles.This ability allows you to design exclusive visual styles and functional layouts for different content types or important pages, greatly enhancing the customization degree of the website.AnQiCMS provides two main ways to achieve this goal: one is to rely on preset naming conventions for automatic matching, and the other is to manually specify template files in the background.

1. Priority-based automatic matching

AnQiCMS designed a smart template matching mechanism.This means that as long as your template file follows the specific naming rules, the system can automatically identify and use them during page rendering, saving you the extra steps of configuration in the background.This method is especially suitable for those structured, numerous and regular personalized pages.

In particular, AnQiCMS supports the following conventions:

  • List pages for specific categories:If you want a list page of content under a specific category (for example, category ID is:10The article category has a unique layout style, you can create a file named in the current theme template folder{模型table}/list-{分类ID}.html. For example, if the table name corresponding to your article model isarticleAnd you want to create a separate list template for the category with ID10Then you need to create a namedarticle/list-10.htmlThe file. When the user accesses the list page of this category, the system will automatically call this template.
  • For the detail page of a specific article or product:Similarly, if you want a specific article or product (such as, one with ID of5) to display a unique detail page style, you can create one named{模型table}/{文档ID}.htmlfile. For example, for an ID of5article, you can createarticle/5.htmlfile. This template will be enabled when this specific article is accessed.
  • details page for a specific single page:For some important single pages on your website (such as, pages with ID2), you can create a file namedpage/{单页面ID}.html, for examplepage/2.html. The system will automatically apply this template when accessing the single page.

These template files that follow the naming conventions must be placed in the current active theme template folder (usually/template/您的主题名/)

2. Flexibly specify the template file in the background

In addition to the convenience of automatic matching, AnQiCMS also allows you to manually specify template files for specific content in the background.This approach provides greater flexibility, especially suitable for scenarios where you want to use custom naming, or need to apply specific templates to content accessed through aliases (URL tokens).

Specify an independent template for categories

If you need to set a custom template for a category, such as a special download category or a news category:

  1. First, log in to the AnQiCMS backend management interface, navigate to the 'Content Management' menu, and select 'Document Classification.'
  2. In the category list, find the category you want to modify, click "Edit", or set it when adding a new category.
  3. In the 'Other Parameters' section of the category editing page, you will find a field named 'Category Template'. Here, you can enter the name of your custom template file, for exampledownload.htmlorcategory-news.html.
  4. If all subcategories under this category also need to follow this template, remember to check the option 'Apply to subcategories'.
  5. Additionally, if you want all the article detail pages under this category to use the same custom template, you can enter the corresponding template file name in the 'Document Template' field.

Specify an independent template for the single page

For single pages such as 'About Us', 'Contact Us', etc., you can also specify a dedicated template:

  1. In the background, go to the "Page Resources" menu and select "Page Management".
  2. When editing or creating a single page, find the "Single Page Template" field in the page settings.
  3. Enter the template file name you have prepared for this single page, for exampleabout-us.html. The document also mentions that you can even name the template file according to the alias of the single page (such asabout) to name the template file aspage/about.htmlThen fill in the "Single Page Template" field in the background.about.htmlThe system will recognize automatically.page/Prefix).

Specify an independent template for a specific article or product.

For some particularly important articles or products, even if they belong to the same category, you can allow them to have an independent detail page layout:

  1. Under the "Content Management" menu, go to "Document Management" or "Product Management", find and edit the article or product you want to set up.
  2. In the "Other Parameters" area of the editing page, you will find a "Document Template" field.
  3. Enter the filename you have designed for this specific content here, for example,product-special-offer.html.

**Practice and Precautions

  • Template file location:Whether automatically matched or manually specified, all custom template files must be placed in the AnQiCMS theme folder currently active. For example, if your theme name isdefaultthencategory-news.htmlThe file should be located/template/default/category-news.html.
  • File extension:AnQiCMS template files are unified in use.htmlAs a suffix.