In AnQiCMS, in order to achieve personalized display of website pages or categories, we do not always have to rewrite complex logic from scratch. The system provides a very flexible and intuitive template file naming convention.These conventions allow us to create template files with specific names, so that the system can automatically identify and apply them, thereby customizing the display styles for different content types.

Firstly, understanding the basic structure of the template file is crucial. All template files are stored in/templatethe directory and use a unified format..htmlAs a file suffix. For example, the files of a template named “default” will be located in/template/default/Below. It is recommended to store styles, JavaScript scripts, images, and other static resources used in the template separately to maintain order and efficiency./public/static/In the directory, to keep it organized and efficient.

The strength of AnQiCMS lies in its support for variousDefault custom template name convention.When the system is rendering the page, it will intelligently search for the existence of template files that match these specific naming rules.If found, they will be used preferentially without the need for any additional configuration on our part.

Specifically, these naming conventions include:

  • Custom template for document detail page:If you want to provide a unique display effect for a specific document, you can name the template file in the following format. For example, if your website has a{模型table}/{文档ID}.htmlformat to name template files. For example, if your website has aarticle(Article) model, where the ID is100If the article needs a special layout, you can create a namedarticle/100.htmlThe template file. When the user accesses the article with ID 100, the system will automatically load this custom template. The same naming convention applies to product models, such asproduct/201.html.
  • Category list page custom templateTo make the article or product list of a specific category have a unique style,{模型table}/list-{分类ID}.htmlthe naming format of the following. Assuming yourproduct(Product) There is an ID in the model5category, you can createproduct/list-5.htmlCustomize the list display for this category. When users browse the product category page with ID 5, they will see this exclusive list layout.
  • Custom template for the single page detail page.:For common single-page pages such as “About Us” and “Contact Us”, customization is also possible. The naming format ispage/{单页面ID}.html. For example, the ID of1The single-page (usually it might be “About Us”), you can createpage/1.htmlto define its display style.

In addition to these naming conventions automatically recognized by the system, AnQiCMS also grants website administrators more advancedcustom template specification capabilities.This means that even if the naming rules mentioned above are not followed, website administrators can still manually assign a completely customized template file for specific documents, categories, or even individual pages according to the needs of content operation.

For example, you may want the 'About Us' single page to have a specially designedabout-us.htmlinstead of the default templatepage/{单页面ID}.html. All you need to do is in/template/你的模板目录/page/Createabout-us.htmlThen edit the single page "About Us" in the background and directly fill in the "Single Page Template" field.about-us.html.AnQiCMS will use the template you specify in the background to render this single page first.The same method also applies to the custom template settings for documents and categories.This method provides great flexibility, capable of handling various personalized display requirements, such as customizing exclusive templates for specific marketing activity pages, download pages, or partner introduction pages.

The AnQiCMS supports two types of organization methods for template files, namely "folder organization mode" and "flattened file organization mode". Regardless of which one is chosen, the naming conventions mentioned above are universally applicable. In addition, to better adapt to mobile device access, AnQiCMS allows us to create in the template directory.mobile/Subdirectory. In thismobile/Under the directory, you can design independent template files for mobile devices according to the same naming conventions as on the PC, thereby providing a differentiated high-quality user experience on both PC and mobile devices.

Through these flexible naming conventions and backend specification mechanisms, AnQiCMS greatly simplifies the complexity of template customization.It allows website operators to efficiently implement highly customized displays for different content types, functional modules, or specific pages, thereby better attracting users, optimizing user experience, and serving specific business objectives.


Common Questions (FAQ)

  1. 问:In AnQiCMS, should I prioritize template naming conventions or manually specify templates in the backend?答:This depends on your customization needs. If you just want to provide a dedicated template for a fixed ID document, category, or single page, and do not want to frequently operate in the background, then follow the naming conventions (such asarticle/100.html)will be more efficient, the system will automatically recognize. But if your customization requirements are more flexible, for example, some documents under a category may need one template and others may need another, or if you want to specify a general but different-named template for a certain page (such aspromo-page.html),then specifying the template file manually in the background will provide greater control. Usually, the manually specified in the background has a higher priority than the default naming convention.

  2. Question: If I created a naming convention template (such asarticle/100.html), but then edited an article in the background and manually specified another template for the article with ID 100 (such asspecial-article.htmlWhich template will finally take effect?Answer: In this case, the template manually specified by the background will take precedencespecial-article.htmlover the naming convention templatearticle/100.html.The system will prioritize processing the template file path you explicitly configure in the background content editing interface.Naming conventions are more of a convenient default mechanism, while backend configuration provides finer-grained control and priority.

  3. 问:Does AnQiCMS support customizing independent templates for mobile-end pages? How can it be implemented?答:是的,AnQiCMS fully supports customizing independent templates for mobile pages. You just need to create a subdirectory namedmobile/in your current template directory, thenmobile/The directory follows the same naming conventions as the PC version (for examplearticle/100.htmlorpage/1.html)Create the corresponding mobile template file. When the website is running in "code adaptation" or "PC+mobile independent site" mode, the system will automatically load according to the user's devicemobile/The corresponding template under the directory.