As an experienced CMS website operation personnel of an enterprise, I know that a clear and efficient template naming rule is crucial for the management of website content and user experience.AnQi CMS provides great flexibility in template design, and also establishes a set of default naming conventions, which is very helpful for us to quickly build and iterate website pages.

All template files in Anqi CMS are named with.htmlAs a suffix, and uniformly stored in the root directory of the system./templateFolder. Each independent template set will have its own directory and must include aconfig.jsonFiles to define the basic information of the template. The CSS, JavaScript, images, and other static resources that the template depends on are recommended to be managed centrally in/public/static/Catalog, to ensure a clear structure and convenient maintenance.

AnQiCMS provides two main modes of organization for templates:Folder organization modeandFlat file organization modeThese two patterns are slightly different in naming, but both aim to provide consistent and easy-to-understand conventions.

For the content model homepage, this is usually a preview page showing all documents under a certain content model. InFolder organization modeThe default naming convention is{模型table}/index.html. For example, if the table name of your content model isarticleThen the homepage template file of the article model isarticle/index.htmlAndFlat file organization modeIn{模型table}_index.html, that isarticle_index.htmlBy this means, the system can clearly identify and load the homepage of the corresponding model.

This is the page that displays the complete content of a single document for the document detail page. InFolder organization modethe following, the default general template file is{模型table}/detail.htmlIn addition, AnQiCMS also supports customizing templates for specific document IDs, following the naming rule is{模型table}/detail-{文档ID}.htmlor more generally,{模型table}/{文档ID}.htmlThis means you can provide a unique display layout for a special document.Flat file organization modeIn the document detail page, the default template file name is{模型table}_detail.html. Although the flattened mode does not explicitly list the ID-specific template, it usually follows a concise_detail.htmlas a general detail page.

Finally, there is the document list page, which is used to display the document list under a certain category. InFolder organization modeIn it, the default general template file is{模型table}/list.htmlIf you need to customize the list page for a specific category, the system will look for{模型table}/list-{文档分类ID}.htmlFor example, the list page of articles with category ID 10 might bearticle/list-10.html.Flat file organization modeIn it, the default template file name for the document list page is{模型table}_list.htmlThis convention makes it easy for us to customize the display of list pages for different models and classifications.

Understand and follow these default naming conventions, which can help us be more efficient in template development and content management.At the same time, Anqi CMS also provides a flexible customization mechanism, allowing us to specify unique template file paths for specific content (such as single pages) in the background, further meeting personalized needs.This design combines convention and flexibility, which is exactly what AnQiCMS provides in content operation.


Frequently Asked Questions (FAQ)

1. If I create a template file with a specific ID for a particular document or category but the file does not exist, how will the system handle it?

AnQiCMS will first attempt to find a template file specific to the ID, if the file does not exist, the system will automatically fallback to finding more generic template files. For example, for the document detail page, if{模型table}/detail-{文档ID}.htmlDoes not exist, the system will try using{模型table}/detail.html. If there is no document list page,{模型table}/list-{文档分类ID}.htmlthe system will fallback to using{模型table}/list.htmlThis fallback mechanism ensures that the website can still display normally even if no specific templates are created for each content, thus avoiding page errors.

2.{模型table}/{文档ID}and{文档分类ID}What does the placeholder specifically represent? How can I obtain this information?

{模型table}It refers to the table name of your content model in the AnQiCMS database, for examplearticle(Article model) orproduct(Product model). You can view or set the "model table name" field for each model in the "Content Management" -> "Content Model" section of the AnQiCMS backend.{文档ID}It refers to the unique identifier ID of the specific document you publish in the AnQiCMS backend, which can be seen in the document list and editing page.{文档分类ID}This refers to the unique identifier ID of the category to which your document belongs, which can be viewed on the document category management page. This information can be directly obtained from the background management interface.

3. The template files, in addition to.htmlsuffix, what encoding or storage requirements should be noted?

All template files are encoded in UTF-8 format. Using other encoding may cause the page to display garbled text and not display normally.Especially Windows users should save template files as UTF-8 encoding when editing them.At the same time, the static resources such as styles, JS scripts, images, and so on used by the template should be stored independently./public/static/directory should not be confused with the template files to maintain the clarity and ease of project structure maintenance.