Where should the AnQiCMS template files be stored, and what file extensions are supported?

Calendar 👁️ 85

AnQiCMS is designed to be very clear and flexible in template file management, aiming to allow users to customize the appearance and functionality of the website efficiently.If you are using AnQiCMS to build or maintain a website, understanding the location of template files and supported suffixes is the foundation for frontend development and customization.

The core home of template files:/templateTable of contents

All AnQiCMS template files are stored in a core directory, which is under the root directory of your website/templateFolder. This directory is the 'home' of all your theme packages. In/templateUnder the directory, each independent theme package will have its own subdirectory, such asdefault/my_custom_themeetc.

In each theme package subdirectory, there is usually oneconfig.jsonThe file. This configuration file records the theme name, version, author, description and other basic information, as well as the template types it supports (such as adaptive, code adaptation, or PC + mobile independent station mode).Through this structure, AnQiCMS can identify and manage different theme packages.

The template file suffix is unified and clear.html

The template file suffix of AnQiCMS is unified.htmlThis means that whether you are creating a homepage template, an article detail page template, a category list page template, or any other page, they should be designed to.html.

This choice is highly consistent with the Django template engine syntax supported by AnQiCMS.It not only maintains the consistency of the file format, but also facilitates the recognition and highlighting by the editor.When editing template files, please ensure that the file encoding is set to UTF-8, especially for Windows users, to avoid garbled text on the page.

The organization pattern of template files: flexible to adapt to different needs

Within each theme package, AnQiCMS supports two main template organization modes to accommodate different development habits and project scales:

  1. Folder organization mode:In this mode, template files are stored in different subfolders according to their function or content type, with a clear structure and easy to manage. For example:

    • Common part:bash.html(Contains header, footer, and other common code for reference by other templates).
    • code snippets:partial/Contents (for example)partial/sidebar.htmlUsed for sidebar,partial/breadcrumb.htmlUsed for breadcrumb navigation).
    • Home:index/index.html.
    • Model-related pages:{模型table}/index.html(Model Home Page){模型table}/detail.html(Document Details Page){模型table}/list.html(Document list page).
    • single page:page/detail.html.
    • Special Page:comment/list.html(Comment List Page)guestbook/index.html(Online Message Page)search/index.html(Search Page)、tag/index.html(Tag Home Page)、errors/404.html(404 Error Page) etc.
  2. Flattened file organization mode:In this mode, all template files are directly stored in the root directory of the theme package, and the file names will include their functions or content types, which is suitable for small projects or users who prefer a simple file structure. For example:

    • Common part:bash.html.
    • code snippets:partial/Table of contents (same as above).
    • Home:index.html.
    • Model-related pages:{模型table}_index.html/{模型table}_detail.html/{模型table}_list.html.
    • single page:page.html.
    • Special Page:comment_list.html/guestbook.html/search.html/tag_index.html/errors_404.htmletc.

It is worth mentioning that AnQiCMS also allows the definition of specific content.Custom template nameFor example, if you have an article with ID 10, you can create a name for it that{模型table}/detail-10.htmlindependent template; or for a single page "About Us", you can name its template aspage/about.htmlThis is associated in the background. This high degree of flexibility allows you to personalize the display of any specific content on the website.

Mobile end template:mobile/Subdirectory

To support mobile adaptation or an independent mobile site, AnQiCMS provides a dedicated mobile template storage location. You can create one in your theme package directory.mobile/Subdirectory. Thismobile/The directory structure and file naming conventions are consistent with the main site template, which can be folder organization mode or flat mode. When the system detects that the user accesses through a mobile device, it will load it preferentiallymobile/The corresponding template under the directory.

Static resources: stored independently/public/static/

Differing from the template file, the static resources (CSS, JavaScript scripts, images, etc.) required by the website should not be mixed with the template file. AnQiCMS specifies that these static resources should be placed separately in the root directory of the website./public/static/In the catalog. This separation helps improve website performance, facilitate CDN acceleration, and make the project structure clearer.

Mastering these about the storage location and naming rules of AnQiCMS template files, you can organize website customization and frontend development more systematically.


Frequently Asked Questions (FAQ)

Q1: Besides.htmlCan I use other file extensions as template files?A1: No. AnQiCMS template engine only recognizes and processes.htmlThe file with the extension is used as a template. If you use other suffixes, the system will not be able to parse it as a template.

Q2: What will happen if I place the template file in the wrong directory?A2: If the template file is not stored in the specified path, AnQiCMS will not be able to find the corresponding template.This usually causes the page to display incorrectly or directly return a 404 error.When modifying or creating a template, please ensure that the file path and naming are checked carefully.

Q3: How should I refer to the CSS or JavaScript files in the theme?A3: You should place your CSS, JS files in the root directory of your website./public/static/In the directory (or its subdirectory). When referencing in the template, you can use the absolute path relative to the root directory of the website, for example<link rel="stylesheet" href="/static/your_theme/css/style.css">. AnQiCMS provides{% system with name="TemplateUrl" %}The tag can help you dynamically obtain the static file address of the current topic, thereby making it more flexible to construct resource paths.

Related articles

How to customize templates in AnQiCMS to change the overall visual style and layout of the website?

In this era that emphasizes brand and user experience, the visual style and layout of a website is the key to its successful operation.AnQiCMS (AnQiCMS) understands this point and therefore provides a highly flexible template customization feature, allowing users without a strong development background to create websites that meet their unique needs with a personalized touch.If you are considering changing the overall style of the website or want to design a dedicated layout for specific content, it will be very helpful to understand how to customize templates in AnQiCMS.

2025-11-07

How to manage custom fields in the content model of AnQiCMS and call them to display on the front-end page?

AnQi CMS is an efficient and customizable enterprise-level content management system, one of its core highlights is the 'flexible content model'.This feature greatly expands the management boundaries of website content, allowing us to create various and unique content structures according to actual business needs.Among these, custom fields (or custom parameters) play a crucial role, allowing our website content to go beyond traditional article titles, body, and summaries, and carry more personalized information, ultimately displaying flexibly on the front-end page.

2025-11-07

How to configure Docker reverse proxy to display multiple independent websites for AnQiCMS multi-site feature?

AnQiCMS (AnQiCMS) is favored by many website operators for its efficient and flexible content management capabilities.Especially its powerful multi-site management feature, combined with Docker containerization technology and reverse proxy, allows you to easily set up and manage multiple independent websites on the same server, greatly enhancing operational efficiency and reducing maintenance costs. ### Discover the charm of multiple sites Imagine that you may have several different brands, aimed at different audiences, or serving different regions, but their content update and management processes are roughly the same.

2025-11-07

How to automatically convert URLs to clickable links in AnQiCMS templates using the `urlize` filter?

In website content management, we often need to display external links in articles, comments, or introductions.Manually adding the `<a>` tag to each URL is not only cumbersome but also prone to errors, especially when dealing with large amounts of user-generated content or importing data from other sources.Fortunately, AnQiCMS provides a very practical template filter——`urlize`, which can automatically identify URLs and email addresses in text and convert them into clickable links, greatly simplifying the work of content managers.

2025-11-07

How to use Django template engine syntax to efficiently display various dynamic content in AnQiCMS?

In AnQi CMS, you will find that the built-in Django template engine syntax is an extremely powerful and flexible tool, which can help you efficiently convert backend data into dynamic and lively content on the frontend page.Master this syntax, and you'll not only be able to display basic text and images, but also build complex, interactive dynamic pages, making your website vibrant.The template syntax design of Anqi CMS is very intuitive, it draws on the characteristics of the Django template engine and integrates the concise and efficient Go language.

2025-11-07

How to use `if-else` conditional tags to control the display logic of content in AnQiCMS templates?

In AnQiCMS templates, make good use of the `if-else` conditional judgment tag to make content display more intelligent In website content operation, we often need to display different content or styles according to different conditions.For example, when the article list is empty, display 'No content', when an article is in the recommended state, add a 'HOT' mark, or add a special style to the first item in the loop.

2025-11-07

How to use the `for` loop tag to iterate and display list data in AnQiCMS template?

In AnQiCMS templates, dynamically displaying list data is one of the core operations for building rich website content.Whether it is displaying the latest articles, hot products, category lists, or any custom content collection, the `for` loop tag is your helpful assistant.It allows you to easily traverse data and customize the display of each item according to your needs.Understanding the basics of the `for` loop tag The `for` loop tag is a control structure in the AnQiCMS template engine used for iterating over collection data.

2025-11-07

How does AnQiCMS support the switching of multiple templates, as well as how to specify an independent template for a specific page or content type?

## The flexible aspects of AnQiCMS: How to handle multi-template switching and personalized page design A flexible template mechanism is crucial for a content management system to maintain competitiveness and adapt to diverse operational needs.AnQiCMS is an efficient enterprise-level content management system that has demonstrated excellent capabilities in this regard. It not only supports multi-template switching at the whole-site level but also provides detailed features for specifying independent templates for specific pages or content types. This is undoubtedly a powerful tool for websites that need to carry out refined content operations. Firstly

2025-11-07