AnQiCMS as an 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 not only ensures the correct presentation of website front-end content but also provides great convenience in content layout and personalized customization.Today, let's unveil the mystery of the AnQiCMS template files together, and see what suffixes and directory secrets they have.
First, AnQiCMS has very intuitive and friendly rules for template file suffixes, it uses uniformly.htmlAs the suffix of the template file. This choice not only makes you, who is familiar with front-end development, feel close, 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 you would write a regular HTML file.Of course, to ensure that the page content displays normally and avoids garbled characters, all template files must be saved in a unified UTF-8 encoding format.
The directory where the template files are stored. All site templates, regardless of how many sets you have, need to be placed in the root directory of the AnQiCMS project./templateIn the folder. This/templateThe catalog is the 'home' of all your design works. In order to better manage and distinguish different template styles or versions, each independent set of templates needs to have its own exclusive subdirectory.For example, you can create/template/default//template/custom-themePlace subdirectories to store different templates.
There will be a named directory within each template directory.config.jsonThe configuration file. This file is like the ID card of the template, containing information such as the name, version, author, creation time, and the most important template type (such as adaptive, code adaptation, PC + mobile independent site) and other metadata.The system will identify and manage your templates based on this file.
AnQiCMS offers two flexible modes for template directory and file organization, you can choose one according to your preferences and project complexity. One isFolder organization modeIt will categorically place 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, and the document list page template is located{模型table}/list.htmlHowever, the single-page detail page is inpage/detail.htmlSuch a pattern structure is clear, easy for large-scale project management. Another isFlat file organization modeIt places all major page templates directly in the root directory of the template, distinguishing by filename, for exampleindex.html/{模型table}_detail.html/guestbook.htmlThis pattern is 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. They have a special destination, namely/public/static/Catalog. This design of separating the template structure from the physical static resources helps to clarify the organizational structure of the website and facilitates caching management and maintenance.
The smart aspect of AnQiCMS 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 specify additional templates in the background.For example, the document detail page may default to searching{模型table}/{文档id}.htmlor{模型table}/detail.html, the document list page will search for.{模型table}/list-{分类id}.htmlor{模型table}/list.htmlwhere a single-page might correspondpage/{单页面id}.htmlorpage/detail.htmlThis 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, and you can completely specify the use of custom-named template files in the background according to the needs of specific documents, specific categories, or specific single pages.For example, create one for the "About Us" pagepage/about.htmland then it can be specified in the backend page management.
In addition, for templates that need to support mobile devices (especially code adaptation or PC+mobile independent site mode), AnQiCMS also provides with caremobile/Subdirectory. Just create it under the main template directorymobileA folder, and by repeating the template file in the same structure under this subdirectory, you can easily customize and display content on the mobile end.
In general, the naming and directory structure design of AnQiCMS templates fully considers ease of use and flexibility. Whether it is unified,.htmlsuffixes, clear and/templateThe root directory, or the choice of two organizational modes, along with intelligent default naming conventions and powerful customization capabilities, are all designed to allow you to manage and present your website content more efficiently and freely.Master these core rules, and your AnQiCMS website operation will be smoother.
Frequently Asked Questions (FAQ)
Ask: Can the template file suffix of AnQiCMS be changed to something other than
.htmlany other form?Answer: No. AnQiCMS uniformly stipulates the use of.htmlAs the suffix of the template file. This is to ensure compatibility with the built-in Go language template engine and maintain the uniformity of internal processing.Changing the file extension may cause the system to fail to correctly identify and parse the template.Ask: If I have multiple different website template styles, where should they all be stored?Answer: All your template styles should be stored in
/templateThis root directory contains. Each template style needs to have its own independent subdirectory, such as/template/theme-aand/template/theme-b. Each subdirectory needs to contain aconfig.jsonfile to describe the basic information of this template.Ask: How does AnQiCMS handle mobile and PC templates, do I need to create a completely independent mobile template?Answer: AnQiCMS supports various template types, including adaptive, code adaptation, and PC+mobile independent site mode. In code adaptation or PC+mobile independent site mode, you can create a folder named
mobile/. In thismobile/In the directory, you can place the mobile-specific template files with the same directory structure and filenames as the main template. The system will automatically identify and load the corresponding template based on the device accessing it.