What is the template file structure and naming convention of AnQiCMS?

Calendar 👁️ 51

As an experienced website operator who deeply understands the operation of AnQiCMS, I know that the foundation of content presentation lies in its flexible and standardized template system.A deep understanding of the template file structure and naming conventions of AnQiCMS is crucial for efficient management of website content, achieving personalized display, and ensuring system stability.The following will elaborate on the template design principles of AnQiCMS.

The AnQiCMS template system aims to provide high customizability and ease of use.The core lies in a clear directory structure and a set of Django-style template syntax.All template files are stored in the root directory of the application/templateIn the folder. Each independent template theme, or a complete website skin, will have its own dedicated subdirectory, for example/template/defaultThis topic subdirectory must also contain oneconfig.jsonConfiguration file.

config.jsonFiles are an important basis for AnQiCMS to recognize and manage templates, which contains the metadata of the template. For example,nameThe field defines the display name of the template,packagespecified the template folder name,versionmarked the version number,descriptionprovided a brief description,authorandhomepagethen indicated the author and website. In addition,createdrecorded the template creation time,template_type(Optional values are 0 for adaptive, 1 for code adaptation, 2 for computer and mobile) defines the response mode of the template, andstatus(0 disabled, 1 in use) indicates the current enabled status of the template. It should be noted that only one template can be in use at a time.

In terms of template file suffixes, AnQiCMS uniformly adopts.html. The template syntax is greatly influenced by the Django template engine, and variable calls use double curly braces, for example{{变量}}Where conditional statements, loop controls, and other logical tags are used in the form of single curly braces combined with percentage signs, for example{% if 条件 %}...{% endif %}These tags must appear in pairs, with clear start and end tags. All template files must use UTF-8 encoding to avoid compatibility issues such as garbled pages.

AnQiCMS supports various website modes in template design to adapt to different terminal devices.This includes adaptive templates, code adaptation templates, and PC + mobile independent site modes.If you choose the last two modes, especially the PC + mobile independent site mode, developers need to create a named directory under the main template directorymobile/The subdirectory is used to store exclusive template files for mobile devices.mobile/The file structure and naming conventions within the directory are consistent with the PC template.

AnQiCMS provides two main template file organization modes:

A folder organization pattern is a recommended, structured method that categorizes template files through multiple directories: At the top level,bash.htmlCommonly used to store common code snippets of a website, such as headers, footers, etc., which can be referenced in other templates.partial/The catalog is used to store smaller code snippets, such as sidebars, breadcrumb navigation, etc. The home page of the website is usually composed byindex/index.htmlDefine. For different content models (such as articles, products), there will be corresponding model home page templates, named in the format of{模型table}/index.html. The general template for content detail pages is{模型table}/detail.htmlAlso, you can create a dedicated template for documents with a specific ID, such as{模型table}/detail-{文档ID}.htmlSimilarly, the content list page has{模型table}/list.htmland for specific categories{模型table}/list-{分类ID}.html. Other functional pages includecomment/list.html(Comment list),guestbook/index.html(Online留言),page/detail.html(Single page details), as well as for a specific single page IDpage/detail-{单页ID}.html. Search page issearch/index.html, the tab page hastag/index.htmlandtag/list.html. Error page such aserrors/404.html/errors/500.htmlas well as the site shutdown prompt pageerrors/close.htmlAlso follow this pattern.

Flattened file organization mode is more concise, it places most template files directly under the theme root directory, distinguishing different types of pages through underscores in file names: common codebash.htmland code snippets directorypartial/The usage is the same as the folder organization mode. The homepage of the website is namedindex.html. The homepage of the model uses{模型table}_index.htmlformat (for examplearticle_index.html). The content detail page and the list page correspond to{模型table}_detail.htmland{模型table}_list.html. Other functional pages such ascomment_list.html/guestbook.html/page.html(Single page details, can also havepage-{单页ID}.html)、search.html/tag_index.html/tag_list.htmland error pageserrors_404.html/errors_500.html/errors_close.htmlall use flat naming conventions.

An

Related articles

What are the detailed steps for installing AnQiCMS with Docker on Baota panel?

As an experienced security CMS website operator, I know that a smooth deployment process is crucial for the quick launch and stable operation of the website.Our team loves AnQi CMS for its lightweight, efficient Go language and powerful SEO features.Deploying AnQi CMS by combining Baota panel and Docker technology has brought convenience and flexibility to a new level.The complete steps for installing Anqicms using Docker on the Baota panel are detailed for you: ### Important Preparations Before Deployment Before installing Anqicms officially

2025-11-06

How to implement multi-site deployment of AnQiCMS through reverse proxy in Docker on Baota panel?

AnQiCMS (AnQiCMS) with its powerful multi-site management capabilities, provides great convenience to operators.In the Docker environment of Baota panel, implementing the multi-site deployment of AnQiCMS through reverse proxy can effectively isolate the running environments of different sites, and can also fully utilize the built-in multi-site features of AnQiCMS to achieve efficient content management and resource integration.As an experienced website operator specializing in Anqi CMS, I will elaborate on this deployment process, helping you easily manage multi-site operations.###

2025-11-06

How to use aaPanel (Baota International Edition) to one-click deploy AnQiCMS in Docker environment?

As a website administrator who deeply understands the operation of AnQiCMS, I know the importance of efficient deployment for the content management system.In today's cloud-native era, the combination of Docker with panel tools provides us with great convenience.AnQiCMS as an enterprise-level content management system developed based on the Go language, with its high efficiency, security, and SEO-friendly features, has become the preferred choice for many small and medium-sized enterprises and content operation teams.Deploy AnQiCMS in Docker environment through aaPanel (Baota International Edition), which can simplify the installation process

2025-11-06

How to install and deploy AnQiCMS using 1Panel in Docker environment?

As a senior website operator, I am well aware of the importance of an efficient, stable, and easy-to-manage content management system (CMS) for corporate websites.AnQiCMS (AnQiCMS) takes advantage of the lightweight and efficient characteristics of the Go language, as well as its rich functional modules, and has become the preferred choice for many small and medium-sized enterprises and content operation teams.In modern operation and maintenance environments, Docker containerization technology combined with a visual management panel like 1Panel can greatly simplify the deployment process and improve management efficiency.Next, I will give you a detailed introduction on how to use Docker environment

2025-11-06

What kind of template engine syntax does AnQiCMS support and how easy is it to learn?

As an experienced CMS website operation personnel, I fully understand the importance of an efficient and easy-to-use content management system for our daily work.Among other things, the flexibility and learning curve of the template engine are directly related to the efficiency of content display and the customizability of the website.AnQiCMS on this point, has provided us with a very friendly solution. ### AnQiCMS Template Engine Syntax Parsing One of AnQiCMS's core strengths lies in the template engine syntax it adopts.

2025-11-06

How to include common code snippets like header and footer in AnQiCMS templates?

As an experienced AnQiCMS website operator, I am well aware of the importance of website template efficiency and maintainability for daily work.A well-designed template structure that ensures consistency in the brand image of the website, improves user experience, and significantly reduces the cost of content updates and website maintenance.In AnQiCMS, reasonably introducing common code snippets, such as the website header and footer, is the key to achieving this goal.

2025-11-06

How to perform conditional judgment (if-else) and loop traversal (for) in AnQiCMS templates?

AnQiCMS (AnQiCMS) is an efficient and customizable content management system. Its template engine design philosophy is to simplify the complexity of content presentation, allowing website operators to focus on content organization and optimization.In the daily operation of websites, we often need to display content based on different conditions, or iterate through list data for dynamic rendering.AnQi CMS provides intuitive and powerful template tags, the most basic and core of which are conditional judgment (`if-else`) and loop traversal (`for`) tags.

2025-11-06

How does AnQiCMS implement multi-level category nesting calls and document list display?

In the operation practice of AnQiCMS, flexible content organization and presentation is the key to attracting and retaining users.The nested call of multi-level classification and the dynamic display of document lists is the core embodiment of AnQiCMS giving operation personnel strong content management capabilities.By skillfully applying system template tags, we can not only build a clear website structure but also present content accurately according to the reader's needs.

2025-11-06