What are the conventions for naming and storing AnQi CMS template files?

Calendar 👁️ 88

When you start using Anqi CMS to build a website, understanding the naming rules and storage path conventions of its template files is crucial for efficient website design and content presentation.A clear file structure can not only help you quickly locate and modify templates, but also make team collaboration smoother and ensure stable operation of the website.

The 'home' of template files: a unified storage location

All template files of Anqi CMS are stored in the root directory of the project/templateIn the folder. It's like a large library, where all the books (template topics) are gathered here. Each independent template topic will be in/templateHas its own dedicated directory, for example/template/default. Inside this directory, there will also be aconfig.jsonThe file is like an 'ID card' for the template theme, recording its name, version, author, and type (such as adaptive template, code adaptation, or PC + mobile independent site mode).

Regarding the style files (CSS), script files (JavaScript), and images, etc., static resources needed in the template, they are placed in the project./public/static/In the catalog. This separation helps to keep the template files tidy, allowing content logic and presentation layer code to perform their respective duties. It is agreed that all template files should use the same suffix..htmlAnd in order to avoid garbled characters, it is strongly recommended to save it in UTF8 encoding.

Flexible and diverse naming and organization patterns

The Anqi CMS provides two main template file organization modes: folder organization mode and flattened file organization mode, you can choose the most suitable one according to the scale of the project and your personal preference.

In folder organization mode, template files are distributed across different subdirectories based on function and type. For example, some common code that is referenced on all pages, such as the website header or footer, is usually placed inbash.htmlin such a file. And reusable code snippets like sidebars, breadcrumb navigation, etc., will be neatly categorized.partial/directory. The homepage of the website is usuallyindex/index.html.

For different content types, AnQi CMS also sets clear paths:

  • The homepage of articles or product models, usually{模型table}/index.html(For example,)article/index.html)
  • The detail pages of them are agreed upon as{模型table}/detail.html(For example,)product/detail.html)
  • List pages are used{模型table}/list.html.
  • The detail page of a single page (such as "About Us") is located atpage/detail.html.
  • In addition, there are also pages such ascomment/list.htmlused for comment lists,guestbook/index.htmlUsed for online messaging, as well aserrors/404.html/errors/500.htmlAnd other error pages.

And the flattened file organization modeIt emphasizes simplicity, placing most template files directly in the theme root directory and distinguishing them through file naming conventions.To avoid naming conflicts and clearly express the function, it is usually necessary to add a prefix or use an underscore to connect the filename.For example, the homepage can beindex.htmlThe detail page of the article model will bearticle_detail.htmlThe single-page detail page may bepage_detail.html.

Mobile end template and highly flexible custom naming

Considering the need for mobile device access, Anqi CMS also supports mobile templates. If your website has chosen the "code adaptation" or "PC + mobile independent site" template mode, then the mobile template will be stored in the current template theme directory under yourmobile/In the subdirectory, the internal directory structure and file naming rules are consistent with the PC template, achieving flexible switching between one template and two layouts.

In addition to these conventional naming conventions, Anqi CMS also gives users great flexibility, allowing them to specify custom template files for specific categories, articles, or single pages in the background. This means you can create a custom template for a specific single page like "About Us".page/about.htmland specify it as the dedicated template for the page. Similarly, if you want all documents under a specific category to usedownload.htmlA template or a specific document (such as an article with ID 10) has a uniquearticle/10.htmlTemplates, these can be easily implemented through the backend settings, and the system will prioritize the application of these more specific custom templates.

Why are these conventions so important?

Clear naming rules and storage path conventions have laid a solid foundation for the long-term maintenance and iteration of the website.It allows both new developers and long-term operators to quickly understand the template structure, quickly locate and modify files.This systematic management approach ensures the website's tidiness, scalability, and greatly reduces the error rate in operation, helping you manage content more efficiently and present a professional website image.

By familiarizing yourself with the template naming and storage conventions of Anqi CMS, you will be able to design and present your website more efficiently, fully leveraging its flexibility and customizability to create a professional and high-quality website that meets your business needs.


Frequently Asked Questions (FAQ)

Q1: How do I start customizing a brand new template theme?

A1: To start a new template theme, you first need to/templateCreate a new folder under the directory, as your subject directory, for examplemy_new_themeThen, create a new folder hereconfig.jsonFile, fill in the basic information of the template, such as name, version, and type. Next, you can start according to the naming and organizational conventions of Anqi CMS.my_new_themeCreate your in the folder.index.html/partial/header.html/article/detail.htmlWait for the template file. Don't forget to put CSS, JS and other static resources in/public/static/the directory and reference them correctly through{% system with name="TemplateUrl" %}the tags.

Q2: I modified the template file, but the front-end page did not take effect immediately, why is that?

A2: This is usually caused by caching. Anqi CMS will enable template caching to improve website access speed.After you modify the template file, the old cache may still be in effect.To solve this problem, you can log in to the Anqi CMS backend, click on the "Update Cache" area to clear the system cache, which will refresh the server

Related articles

How can I customize the content display layout of the AnQi CMS website?

The layout of website content display is a key factor in attracting visitors, enhancing user experience, and optimizing search engine rankings.A clear, beautiful, and functional layout that can make your website stand out among competitors.AnQiCMS (AnQiCMS) is an efficient content management system that provides high flexibility, allowing you to customize the display of website content according to your actual needs.This article will deeply explore how to customize the content display layout of the Anqi CMS website, helping you turn your creativity into reality and create a website with a unique style.--- ###

2025-11-08

How to use a for loop to traverse an array and handle an empty array in Anqi CMS template

During the template development process of AnQi CMS, dynamic data display is one of the core requirements.No matter whether it is an article list, product display, or navigation menu, we cannot do without traversing array or collection data.How to elegantly handle empty data in this process, ensuring the beauty of the page and user experience is equally important.The AnQi CMS template engine supports powerful features similar to Django template syntax, among which the `for` loop is a powerful tool for handling data lists.

2025-11-08

How to use if/else condition judgment to control content display in Anqi CMS template?

In AnQi CMS template creation, flexibly controlling the display of content is the key to improving website user experience and management efficiency.Whether it is to display specific information based on different conditions, or to implement more complex personalized layouts, conditional judgment is an indispensable tool.Today, we will delve into how to use the powerful `if/else` conditional judgment in Anqi CMS templates to accurately control the presentation of content. The template engine of AnQi CMS adopts syntax similar to Django template syntax, which allows web developers familiar with web development to quickly get started. Among them

2025-11-08

How to perform initial arithmetic operations on user input data in AnQi CMS template?

In AnQiCMS template design, performing preliminary arithmetic operations on user input data is a key link in achieving dynamic content display and interactive logic.AnQiCMS powerful template engine, draws on the characteristics of Go language and Django templates, providing developers with flexible and easy-to-understand arithmetic calculation capabilities, allowing you to handle various numerical logic in front-end templates without writing complex backend code.

2025-11-08

How to effectively organize and reference website static resources (CSS/JS/images)?

Building and managing websites in AnQiCMS (AnQiCMS), efficient organization and referencing of static resources (CSS styles, JavaScript scripts, images, etc.) is the key to improving website performance, ease of maintenance, and user experience.Our Anqi CMS provided us with clear guidelines and practical features, helping us easily cope with these challenges. ### One: A Clear and Ordered Directory Structure: The Way to Organize Static Resources Good file organization is the foundation of efficient management of static resources.In AnQi CMS

2025-11-08

How are the syntax rules of template variables and tags similar to Django?

When building and customizing the AnQiCMS website, the template plays a core role.AnQiCMS's template system draws on the power and simplicity of the Django template engine, which means that whether you are new to it or already familiar with other modern template languages, you can quickly get started.The syntax rules revolve around how to effectively display dynamic data and control page logic, making the website content flexible and organized.Understand the core of the AnQiCMS template system, you first need to distinguish between two main elements: variables and tags.

2025-11-08

How to ensure that the encoding of the template file is correct and avoid garbled characters on the front-end page?

The website front-end page displaying garbled characters is undoubtedly one of the most headache-inducing problems.When visiting a website, the originally clear and readable text turns into a pile of undecipherable symbols, which not only severely affects the user experience but also makes the website look unprofessional.For friends using AnQiCMS to build and manage websites, ensuring the correctness of the template file encoding is a key step to avoid such issues.

2025-11-08

What kinds of responsive or adaptive template display modes does AnQiCMS support?

In today's mobile internet age, the user experience of websites is no longer limited to computer screens.Whether it is a smartphone, tablet, or various sizes of displays, the website must be presented in **status**.AnQiCMS understands this and therefore offers a variety of display options in the template to ensure your content reaches every visitor seamlessly. ### One, Adaptive Template Mode (Responsive) Let's talk about the most common "adaptive template" mode first.The core of this pattern lies in 'adaptability', which allows the website to 'change with no change'

2025-11-08