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