AnQiCMS as a high-efficient and customizable enterprise-level content management system, follows a clear and flexible set of rules in the organization and use of template files.For website operators and developers, a deep understanding of these regulations can not only ensure the correct presentation of website front-end content, but also provide great convenience for content layout and personalized customization.Today, let's together unveil the mystery of AnQiCMS template files and see what kind of suffixes and storage directories they have.

Firstly, AnQiCMS has very intuitive and friendly specifications for template file suffixes, it uses uniformly.htmlAs a template file suffix.This choice not only feels familiar to you who are familiar with front-end development, but also is well compatible with the built-in template engine mechanism of the Go language, avoiding the threshold of learning additional specific suffixes.You can build your page structure and content just like writing a regular HTML file.Of course, in order to ensure that the page content can be displayed normally and avoid garbled characters, all template files must be saved in a unified UTF-8 encoding format.

The next is the directory where the template files are stored. All site templates, regardless of how many sets you have, need to be stored in the root directory of the AnQiCMS project./templatefolder./templateThe catalog is the 'home' of all your design works.In order to better manage and differentiate between different template styles or versions, each independent template set needs to have its own dedicated subdirectory./template/default//template/custom-themeSubdirectories are used to store different templates.

There will be a subdirectory named within each template.config.jsonThe configuration file.This file is like the identity card of a template, containing metadata such as the template name, version, author, creation time, and the most important template type (such as adaptive, code adaptation, PC + mobile independent site) and so on.The system will identify and manage your templates based on this file.

AnQiCMS provides two flexible modes for template directory and file organization, and you can choose one based on your preference and project complexity. One isFolder organization mode,it categorizes different types of page templates into corresponding subfolders. For example, the homepage template may be locatedindex/index.html,the document detail page template is located{模型table}/detail.html,the document list page template is located{模型table}/list.html, and the single-page detail page is inpage/detail.htmletc. This pattern has a clear structure and is easy for large-scale project management. Another isFlat file organization modeIt places all major page templates directly under the root directory of the template, distinguishing by filename, for exampleindex.html/{模型table}_detail.html/guestbook.htmlEnglish.This pattern may be more convenient for small projects or developers who prefer a simple structure.No matter which one you choose, as long as you maintain internal consistency, AnQiCMS can support it well.

It is worth mentioning that AnQiCMS has clear storage regulations for static resources such as CSS styles, JavaScript scripts, images, etc. that are needed in the templates. They have a special place for that, namely,/public/static/Table of contents. This design of separating the template structure from the physical static resources helps to clarify the website's organizational structure, facilitating caching management and maintenance.

The smartness of AnQiCMS also lies in its set of default template file naming conventions.This means that for many common page types, the system can automatically identify and apply the corresponding template even if you do not make additional template specifications in the background.{模型table}/{文档id}.htmlor{模型table}/detail.htmlThe document list page will search for,{模型table}/list-{分类id}.htmlor{模型table}/list.html, and the single page may correspondpage/{单页面id}.htmlorpage/detail.html.This convention greatly simplifies the configuration of templates and improves development efficiency.Of course, this intelligent matching is not mandatory.AnQiCMS fully understands the personalized needs of operators, you can completely specify the use of a custom named template file according to the needs of specific documents, specific categories, or specific single pages in the background.page/about.html, and specify it in the background page management.

Moreover, for templates that need to support mobile devices (especially code adaptation or PC+mobile independent site mode), AnQiCMS also provides thoughtfullymobile/Subdirectory. You just need to create under the main template directory.mobileThe folder, and then repeat the template files in the sub-directory with the same structure as the main template, can easily achieve the customization and display of mobile content.

In general, the template file naming and directory structure design of AnQiCMS takes full consideration of usability and flexibility. Whether it is unified.htmlsuffix, clear and/templateThe root directory, the choice of two organization modes, and the intelligent default naming conventions and powerful customization capabilities are all designed to help you manage and present your website content more efficiently and freely.Master these core rules, and your AnQiCMS website operation will be smoother.


Common Questions (FAQ)

  1. 问:Can the template file suffix of AnQiCMS be changed to a form other than.htmlother than答:No. AnQiCMS uniformly stipulates that the use.htmlAs a template file suffix.This is to ensure compatibility with the built-in template engine of the Go language and maintain the uniformity of internal processing.Changing the file extension may cause the template to be incorrectly identified and parsed by the system.

  2. 问:如果我有多套不同的网站模板风格,它们都应该如何存放?答:您所有的模板风格都应存放在English/templateThis root directory. Each template style needs to have its own independent subdirectory, for example/template/theme-aand/template/theme-b. Each subdirectory also needs to contain aconfig.jsonfile to describe the basic information of this template.

  3. 问:How does AnQiCMS handle mobile and PC templates, do I need to create a completely independent mobile template?答:AnQiCMS supports various template types, including auto, code adaptation, and PC+mobile independent site mode. In code adaptation or PC+mobile independent site mode, you can create a file namedmobile/ directory.mobile/In the directory, you can store the mobile-specific template files with the same directory structure and filenames as the main template. The system will automatically recognize and load the corresponding template based on the visiting device.