When you start using the AnQi CMS to build a website, understanding the naming rules and storage path conventions of its template files is the key to efficient website design and content presentation.A clear file structure can not only help you quickly locate and modify templates, but also make team collaboration smoother and ensure the stable operation of the website.

The 'home' of template files: a unified storage location

All template files of Anqi CMS are stored in the root directory of the project./templateIn the folder. This is like a large library, where all books (template themes) are collected here. Each independent template theme will be in/templatehas its own dedicated directory, for example/template/default. This directory will also contain aconfig.jsonThe file, which is like an 'identity card' of the template theme, records the name, version, author, and type of the template (such as adaptive template, code adaptation, or PC+mobile independent site mode).

Regarding the style files (CSS), script files (JavaScript), and other static resources needed in the template, they are all placed in the project's/public/static/The content of the directory. This separation helps maintain the cleanliness of the template files, allowing content logic and presentation layer code to perform their respective functions. It is agreed that all template files should use the following suffixes..htmlAnd in order to avoid garbled characters, it is strongly recommended to save using UTF8 encoding.

Flexible and diverse naming and organization patterns

The AnQi CMS provides two main template file organization modes for user management and development convenience: folder organization mode and flattened file organization mode. You can choose the most suitable method according to the scale of the project and personal preference.

In folder organization modeThe template file will be distributed in different subdirectories according to function and type. For example, some common codes that are referenced on all pages, such as the website header or footer, are usually placed inbash.htmlsuch files. And reusable code snippets like sidebars, breadcrumb navigation will be neatly categorizedpartial/the homepage of a website is usuallyindex/index.html.

For different content types, the security CMS also sets clear paths:

  • The homepage of models such as articles or products, usually is:{模型table}/index.html(For example,article/index.html).
  • Their detail pages are then agreed upon as:{模型table}/detail.html(For example,product/detail.html).
  • The list page uses:{模型table}/list.html.
  • Single-page (such as "About Us") detail page, locatedpage/detail.html.
  • In addition, there are also templates for such pages ascomment/list.htmlused for comment listguestbook/index.htmlFor online messages, as well aserrors/404.html/errors/500.htmland error pages.

The flattened file organization modeThen it focuses more on simplicity, placing most template files directly under the theme root directory, and distinguishing them through file name conventions.To avoid naming conflicts and clearly express the function, it is usually necessary to add a prefix or use underscores to connect the filename.index.htmlarticle_detail.html, single page detail page might bepage_detail.html.

mobile template with highly flexible custom naming

Considering the need for mobile device access, the security CMS also supports mobile templates. If your website has chosen the template mode of "code adaptation" or "PC+mobile independent site", then the mobile template will be stored in the current template theme directory under yourmobile/In the subdirectory, the directory structure and file naming rules are consistent with the PC template, achieving flexible switching between one template and two layouts.

Besides these conventional naming conventions, Anqi CMS also gives users great flexibility, allowing them to specify custom template files for specific categories, articles, or single pages in the background. This means you can create a specific single page like "About Us".page/about.html,and specify it as the dedicated template for this page in the background. Similarly, if you want all documents under a specific category to usedownload.htmlTemplate, or a specific document (such as an article with ID 10) has a uniquearticle/10.htmlTemplate, these can all be easily implemented through the backend settings, and the system will prioritize the application of these more specific custom templates.

Why are these conventions so important?

Clear naming rules and storage path conventions, laying a solid foundation for the long-term maintenance and iteration of the website.It allows both new developers and long-term operators to quickly understand the template structure, quickly locate and modify files.This systemized management approach ensures the tidiness, scalability of the website, and greatly reduces the error rate during operation, helping you manage content more efficiently and present a professional website image.

By familiarizing yourself with the template naming and storage conventions of the Anqi CMS, you will be able to design and present your website more efficiently, fully leveraging its flexibility and customizability to create a professional and high-quality website that meets your specific business needs.


Common Questions (FAQ)

Q1:If I want to start a completely new template theme, how should I begin?

A1:To start a new template theme, you first need to/templateCreate a new folder under the directory, as your subject directory, for examplemy_new_theme. Then, create aconfig.jsonFile, fill in the basic information of the template, such as name, version and type. Then, you can start according to the naming and organization conventions of Anqi CMS.my_new_themeCreate your folder within.index.html/partial/header.html/article/detail.htmlThe template file is ready. Don't forget to put CSS, JS, and other static resources in it/public/static/the directory, and reference them correctly in the template through{% system with name="TemplateUrl" %}the tag.

Q2:I modified the template file, but the front-end page did not take effect immediately, why is that?

A2:This is usually caused by caching.The website access speed will be improved by enabling template caching for AnQi CMS.When you modify the template file, the old cache may still be in effect.