In AnQiCMS, 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 level of the website.AnQiCMS provides two main methods to achieve this goal: one is to rely on predefined naming conventions for automatic matching, and the other is to manually specify template files in the background.
1. Automatic matching with agreements taking priority
AnQiCMS has designed a smart template matching mechanism.This means that as long as your template file follows the specific naming conventions, the system can automatically recognize 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.
Specifically, AnQiCMS supports the following conventions:
- List page for specific categories:If you want the list page of content under a certain category (for example, the category ID is
10The article classification (auto) has a unique layout style, you can create a file named{模型table}/list-{分类ID}.htmlin the current theme template folder. For example, if the table name corresponding to your article model isarticle,and you want to create an independent list template for the category with ID of10one 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, an item with ID of
5) to display a unique page style, you can create a page named{模型table}/{文档ID}.htmlThe file. For example, for an ID of5article, you can createarticle/5.htmlfile. When this specific article is accessed, this template will be enabled. - details page for a specific single page:For some important single pages on your website (such as, pages with ID
2), you can create a file namedpage/{单页面ID}.html, for examplepage/2.html. The system will automatically apply this template when accessing this single page.
These template files that follow the naming conventions must be placed in the currently active theme template folder (usually/template/您的主题名/).
2. English flexible specification of template file
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).
English specification of independent template for category
If you need to set a custom template for a category, such as a special download category or a news category:
- First, log in to the AnQiCMS backend management interface, navigate to the "Content Management
- In the category list, find the category you want to modify, click "Edit", or set it when adding a new category.
- In the classification editing page, you will find a field named "Classification Template" under the "Other Parameters" section. Here, you can enter the filename of your custom template, for example,
download.htmlorcategory-news.html. - If all the subcategories under this category also need to follow this template, remember to check the 'Apply to subcategories' option.
- Additionally, if you want all 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 a single page
For pages such as “About Us” and “Contact Us”, you can also specify a dedicated template for them:
- In the backend, go to the “Page Resources” menu, and select “Page Management”.
- Edit or create a single page, find the "Single Page Template" field in the page settings.
- Enter the filename of the template you have prepared for the single page, for example,
about-us.html。Document also mentions that you can even name the template file according to the alias of a single page (such asabout) topage/about.html, and then fill in the "Single Page Template" field in the backgroundabout.html(the system will recognize intelligently)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 let them have an independent detail page layout:
- Under the "Content Management
- In the "Other Parameters
- Here you enter the filename you have designed for this specific content, for example,
product-special-offer.html.
**Practical Tips and Considerations
- Template file storage location:Whether it is automatic matching or manual specification, all custom template files must be placed in the currently activated AnQiCMS theme folder. For example, if your theme name is
defaultso thatcategory-news.htmlThe file should be located/template/default/category-news.html. - File extension:AnQiCMS template files are unified in use
.htmlsuffix.