AnQiCMS is a system designed to provide an efficient content management solution for small and medium-sized enterprises and content operation teams, its template file organization structure under the multi-site mode is carefully designed to ensure flexibility, maintainability, and independence.In a multi-site environment, AnQiCMS allows administrators to manage multiple sets of templates in a unified template library and select the appropriate template set for each site, thereby decoupling content from presentation.
All template files are stored in the AnQiCMS installation directory/templateIn the root directory. Under this root directory, each independent template is organized in a separate subdirectory, for example/template/defaultor/template/my_custom_theme. Each template subdirectory contains aconfig.jsonThis file defines the name, version, author, description, and applicable types (such as adaptive, code adaptation, PC + mobile independent site mode, etc.) of the template, which is the key to AnQiCMS identifying and managing templates. The static resources related to the template, including CSS stylesheets, JavaScript scripts, and images, are stored in a unified manner./public/static/Under the directory. Typically, these static resources are further organized into subdirectories by template name, for example/public/static/default/css/style.cssThis ensures a clear separation of template resources from code.
AnQiCMS's template file organization mode is mainly divided into two types to meet different development preferences and project requirements.
The first one isFolder organization mode. In this mode, template files reflect their functions and page types through directory hierarchies. For example, common page elements such as headers and footers are usually abstracted tobash.htmlIn the file, while code snippets (such as sidebars or breadcrumbs) are storedpartial/in subdirectories. Specific page types also have corresponding directory structures, such as the home page isindex/index.htmlthe home page of the document model is{模型table}/index.htmlThe document detail page is{模型table}/detail.htmlAnQiCMS also supports more detailed template file naming for specific document ID or category ID, such as{模型table}/detail-{文档ID}.htmlor{模型table}/list-{文档分类ID}.htmlOther like comment list (comment/list.html), Online留言 (guestbook/index.html), Single page detail (page/detail.html) of search pagesearch/index.html), Tab page (tag/index.htmlortag/list.html), And various error pages (such aserrors/404.html,errors/500.html) Also have a clear storage path.
The second isFlat file organization mode. Unlike the folder organization mode, this mode tends to place all template files directly in the template root directory and distinguish page types by file name prefixes. For example, the homepage isindex.html, and the model home page is{模型table}_index.html, the document detail page is{模型table}_detail.htmlThis approach reduces the directory hierarchy, making file management more direct, but may require stricter naming conventions to avoid confusion. Similarly, public codebash.htmland code snippets directorypartial/It still exists. The error page is likeerrors_404.htmlanderrors_500.htmlAlso uses flattened naming.
Whether adopting any organization mode, AnQiCMS provides independent mobile template support. The mobile templates are stored in the main template directory under.mobile/In the subdirectory, the internal directory structure or file naming method is consistent with the desktop template, effectively realizing the separation management of the PC and mobile interface.
AnQiCMS further enhances the customization ability of templates through flexible custom naming conventions. In addition to the default structure mentioned above, the system allows developers to create template files with independent names for specific documents, lists, or single pages, for example, to create a template file for a document with ID 10{模型table}/{文档id}.htmlOr create a category with ID 1{模型table}/list-{分类id}.htmlThis means that even within a shared template set, it is possible to specify unique visual and functional presentations for very specific pages without requiring additional configuration in the background.
In general, the template file structure of AnQiCMS under the multi-site mode reflects a balance between centralized management and flexible customization. Through unified/templateThe library allows each site to easily select and apply the required template sets, and the clear directory and naming conventions within the template sets greatly simplify the development, maintenance, and expansion of templates.
Frequently Asked Questions
1. Do all sites in the AnQiCMS multi-site mode need a set of independent template files?
AnQiCMS multi-site mode does not require each site to have a set of independent template files. Instead, all template sets are stored in the AnQiCMS installation directory./templateThe root directory. Each subdirectory represents a complete template set.When you create a new site in the AnQiCMS background, you can select one from these existing template sets as the default template for the new site.This mechanism implements the sharing and reuse of template resources, reducing storage space usage and management complexity.
2. How to customize a template for a specific site under AnQiCMS multi-site mode?
To customize templates for specific sites in multi-site mode, you have two main methods.First, you can directly modify the files in the selected template set, but this will affect all sites using the template set.The more recommended way is, in/templateCreate a new template subdirectory under the directory (for example/template/custom_for_siteA),to copy the existing template or design from scratch. Complete the creation and configuration of the new template set (includingconfig.jsonAfter uploading the file, log in to the backend of the site you want to customize, and apply this new template set through the template management feature.
3. How to manage and reference static resources (CSS, JS, images, etc.) in the multi-site mode of the template file?
Static resources in the template file are usually stored in/public/static/Under the directory, and organize according to the template package name, for example/public/static/default/css/style.cssWhen referencing these resources in the template file, you can use the resources provided by AnQiCMS{% system with name="TemplateUrl" %}A tag to dynamically get the static resource root path of the current site template. For example, referring to the stylesheet can be written as<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">This way, no matter which template the site switches to, the system can automatically point to the correct static resource path to ensure that the resources are loaded correctly.