How does AnQiCMS automatically apply the default display template for documents or categories through naming conventions?

Calendar 👁️ 60

In website operation, template management is the key to ensuring the professionalism and consistency of content display.For many operators, manually selecting or specifying a template for each new article and each new category is undoubtedly a repetitive and time-consuming task.AnQi CMS understands this pain point and therefore introduces a set of intelligent naming conventions, allowing the system to automatically identify and apply default display templates, thereby greatly simplifying our daily operations.

The cleverness of this function lies in the fact that AnQiCMS can intelligently associate content with preset design styles according to the specific naming rules of template files.This means, as long as our template file follows these conventions, the system can act like an efficient assistant, automatically finding a suitable "dressing" for the content, thus saving us the trouble of configuring each one individually.

In particular, this naming convention is mainly reflected in the following types of content:

FirstlyDocument detail page. When you want a specific article or product detail page to have a unique layout and don't want to manually select a template each time, AnQiCMS allows you to name conventions via document ID.The file format is{模型table}/{文档id}.htmlFor example, if your article model (usually namedarticle) There is an article with ID 123, then you can create a folder named in your template folderarticle/123.htmlfile. When the user accesses this article with ID 123, AnQiCMS will automatically load this exclusive template without any separate setting in the background. Here is the{模型table}It is the table name corresponding to the content model in the database, for example, articles are usuallyarticle, products areproduct.

Next isCategory list page. The document list under a certain category, AnQiCMS also supports the application of automated templates through naming conventions. Its file format is{模型table}/list-{分类id}.htmlFor example, if you have a category with ID 45 and it belongs to the 'article' model, and you want its list page to have a special layout, then you just need to createarticle/list-45.htmlThis file. AnQiCMS will automatically apply it on the list page of the category, so that the content under the category will be presented in the style you expect.

Furthermoresingle page. For independent pages such as “About Us”, “Contact Information”, or any custom static pages, the naming convention still applies. The file format ispage/{单页面id}.htmlFor example, if your "Contact Us" page ID in the backend is 78, you can create a name forpage/78.htmlThe template file. When the user accesses this single page, the system will intelligently call the exclusive template you have set for the page with ID 78.

It is worth emphasizing that AnQiCMS's intelligent mechanism is not a one-size-fits-all solution; it provides a high degree of flexibility. Although naming conventions can automatically apply templates, in the background management interface, we can still target specific documents, categories, or single pages.Manual template settingFor example, when editing a document, you will see a "document template" field;When editing categories, there is a "category template" field; and in single page management, there is also an "single page template" option.These manually set priorities take precedence over naming conventions. This means that you can always break the rules for special content, giving it a completely different design, especially when it comes to specific promotions, A/B testing, or displaying special content. This manual override feature is very practical.It allows us to enjoy the convenience brought by automation while not losing the freedom of personalized customization.

All these, according to the naming convention or manually specified template files, need to be stored uniformly in the template theme directory currently in use./templatein the folder. For example, if your template theme name is "default", then these files will be placed intemplate/default/Inside the directory. In addition, AnQiCMS supports responsive design, if your website needs a separate mobile template, just create it in the template theme directory.mobileSubdirectory, and place the corresponding template files according to the same naming convention in it.

In conclusion, AnQiCMS greatly simplifies the application and management of website templates through a set of intelligent naming conventions.It makes the connection between content publishing and page design more smooth, helping operators to significantly improve work efficiency while ensuring the professionalism and consistency of the website.This balance between efficiency and customization is exactly what AnQiCMS is committed to creating for users.


Frequently Asked Questions (FAQ)

  1. Which has a higher priority, the template applied automatically by the naming convention or the template manually set in the background?The template specified manually for documents, categories, or single pages has a higher priority.If the background manually sets a template, even if there is a template file that conforms to the naming convention, the system will prioritize using the manually specified template.
  2. How will AnQiCMS handle it if I have not created a template file with a naming convention for a specific ID?If AnQiCMS cannot find a template file that conforms to the specific ID naming convention, it will fall back to using the default universal template for the content type (such as article, product, category, single page). For example, if it cannot findarticle/123.htmlIt may try to loadarticle/detail.htmlOr (document details)article/list.html(Category list).
  3. Does this naming convention support all types of content?At present, the naming convention mainly supports document detail pages, category list pages, and single pages.These are the most common and highly customized page types on the website.For other pages like search result pages, tag pages, etc., AnQiCMS usually has fixed default templates or general template tags for us to flexibly call.

Related articles

Where should the mobile-specific template file be stored to be recognized by AnQiCMS?

Provide special optimization for the mobile experience of the website in AnQiCMS (AnQiCMS), which is a very practical requirement.Benefiting from the flexible template mechanism of AnQiCMS, we can easily achieve this goal.When it is necessary to provide a set of independent template files for mobile devices, the storage location and configuration method of these templates are crucial.

2025-11-08

Why is UTF8 encoding crucial for the display of content in AnQiCMS templates?

## Content display no longer troubles: Why is UTF-8 encoding so critical for AnQiCMS templates?In the process of building and operating a website with AnQiCMS, we often strive for the website's efficiency, stability, and diverse display of content.However, there is a seemingly basic but actually crucial link that, if not handled properly, will cause all our efforts to be wasted - that is the character encoding of the template file.Especially for AnQiCMS, UTF-8 encoding is not just a recommendation, it is the core foundation to ensure that website content is displayed correctly and clearly.

2025-11-08

How to use conditional judgment and loop control to dynamically adjust the display of content?

In Anqi CMS, we often encounter scenarios where we need to display different information based on specific conditions or repeat a series of contents.At this time, by flexibly using conditional judgment and loop control, the website content can become more vivid and intelligent.The AnQi CMS template feature provides powerful syntax support similar to the Django template engine, through these tags, we can easily achieve dynamic content adjustment without writing complex background code. ### Conditional judgment: Make the content 'speak to people' Conditional judgment is the basis for dynamic content display.Imagine

2025-11-08

How to display variables in AnQiCMS templates?

In AnQiCMS templates, how to effectively display variable data is a core skill that every website operator and template creator needs to master.AnQiCMS uses a syntax similar to the Django template engine, making data calls and display both intuitive and flexible.This article will delve into various ways to display variables in AnQiCMS templates, helping you accurately present dynamic information such as backend configuration data and article content on the website front-end.

2025-11-08

How does the `template_type` setting in `config.` affect the overall display mode of the website?

AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides great convenience to our users.During the process of building and operating a website, there is a core configuration file called `config.`, which plays a vital role in each template directory.

2025-11-08

How to reuse header, footer and other common display elements in AnQiCMS templates?

In website operation, efficiency and consistency are the key to success.When you manage a website, you will find that many elements appear repeatedly on different pages, such as headers, footers, navigation bars, sidebars, and so on.If you copy and paste this code manually every time, it is not only inefficient but also prone to errors, not to mention the cumbersome task of adjusting each one individually during subsequent modifications.Fortunately, AnQiCMS's template system is designed to be very flexible, providing powerful mechanisms to help us efficiently reuse these common display elements, ensuring the uniformity of the website style and making maintenance easier.

2025-11-08

How to embed reusable display components such as sidebars or breadcrumbs in a page?

In website operation, building an efficient and easy-to-maintain website is the key to success.AnQiCMS (AnQiCMS) is well aware of this, providing a flexible template mechanism that allows us to easily embed reusable display components on the page, such as sidebars and breadcrumb navigation.This modular method not only improves development efficiency, but also ensures the consistency of the overall style of the website and future maintainability.This article will delve into how to effectively create and embed these important reusable components using the template system in AnQiCMS.##

2025-11-08

Which is the default display template file for the home page?

The homepage, as the first impression for users visiting your site, is of great importance.It carries multiple functions such as brand image, core information display, and user guidance.For those who are using or planning to use AnQiCMS (AnQiCMS) to build websites, understanding which file is behind the scenes controlling the display of this key page is the first step in customization and content optimization. AnQi CMS is committed to providing an efficient, customizable content management solution, naturally also providing you with great freedom to control this core page. Then

2025-11-08