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?

Calendar 👁️ 72

The flexibility of AnQiCMS: How to handle multi-template switching and personalized page design

In a content management system, a flexible template mechanism is the key to maintaining the competitiveness of the website and adapting to diverse operational needs.AnQiCMS as an efficient enterprise-level content management system has demonstrated excellent capabilities in this regard. It not only supports multi-template switching at the level of the entire site but also provides detailed features for specifying independent templates for specific pages or content types. This is undoubtedly a powerful tool for websites that require refined content operation.

Firstly, we need to understand the template system of AnQiCMS. All template files are stored in/templateUnder the directory, each independent template package will have its own folder, which contains aconfig.jsonconfiguration file. This file defines the name, version, author, and most importantly,Template Type. Template types include Responsive, Code Adapted, and PC+Mobile Separate Sites.Choosing the appropriate template type is the first step in website construction, especially when you need to provide an independent optimized experience for mobile visitors, such as after selecting the PC+mobile independent mode, AnQiCMS will automatically identifymobile/A template file under the subdirectory, thus achieving independent template rendering for mobile terminals.In the background, switching and enabling different main templates is very intuitive, usually just a simple selection in "Template Design" or "Global Settings" is needed.

AnQiCMS is truly powerful in its fine-grained template specification feature.This allows website administrators to flexibly apply different designs to different pages based on content features or marketing objectives, without changing the entire site template.

Specify an independent template for a specific category and document

In content management, for example, on article list pages or product detail pages, we often encounter situations where special layouts are needed. AnQiCMS provides the option to directly specify templates in the 'Document Classification' and 'Publish Document' interfaces:

  • Category template:When you edit a category in the background, you will find a "Category Template" field.Here you can specify a custom template file for this category.For example, your "news center" category may need a concise news list template (such asnews/list.html),while the "product introduction" category may require a more visually striking product display template (such asproduct/showcase.html)。Furthermore, you can also check the 'Apply to subcategories' option to make all subcategories under the current category automatically inherit this template setting, saving the trouble of repeated configuration.
  • Document template:For personalized needs for a single document, AnQiCMS also takes full consideration.On the interface for publishing or editing documents, there is a "document template" field.If you want an article (such as an important white paper or an event detail page) to have a unique display page, just enter a custom template filename (such asspecial_report.htmlThe system will prioritize the use of the template specified here to render the document, ignoring the default template of its category or content model.

Specify an independent template for the single page

In addition to articles and products, websites usually also have independent single pages such as "About Us", "Contact Information", and so on.AnQiCMS's 'Page Management' feature also supports specifying independent templates for these single pages.When editing a single page, you can fill in the specific template file name in the "Single Page Template" field.For example, create one for the "About Us" pagepage/about.htmlA dedicated template that distinguishes it from other ordinary pages.

AnQiCMS intelligent template matching convention

In addition to manually specifying in the background, AnQiCMS also has a set of intelligent template file naming conventions that can automatically match templates in certain situations, greatly improving efficiency:

  • Document default custom template:If you create a file that conforms to the{模型table}/{文档id}.htmlformat in the template folder, the system will automatically apply it to the corresponding document. For example, if your article model table isarticle, and it existsarticle/123.htmlThis file, then the article with ID 123 will automatically use this template.
  • Document list default custom template:Similarly, for the category list page, you can create{模型table}/list-{分类id}.htmlThe template file format, AnQiCMS will automatically match it to the category list corresponding to the corresponding ID.
  • Default custom template for single page:For a single page, the system will search forpage/{单页面id}.htmlthe file format.

These naming conventions mean that for some commonly used or fixed ID pages, you even do not need to enter the background for configuration, just place the template file in the correct position, the system can automatically identify and apply it, which is very convenient for batch processing or for scenarios that require rapid going online.

In summary, AnQiCMS supports mainstream template switching, combines fine-grained specific page, category, and document template specification features, and intelligent template file naming conventions, providing website operators with great freedom.Whether it is to adjust the overall style of the site or to create a unique display form for specific content, AnQiCMS can provide a powerful and flexible solution to help your website better attract visitors, improve user experience and content marketing effectiveness.


Frequently Asked Questions (FAQ)

How to enable a new template package in AnQiCMS?

To enable a new template package, you need to upload the template file to the AnQiCMS installation directory first./templateIn the folder, make sure each template package has its own subfolder and a copyconfig.jsonConfigure the file. Then, log in to the AnQiCMS backend, navigate to the relevant pages of "Template Design" or "Global Settings", and you should be able to see the newly uploaded template in the template list.Select it and click Save or Enable.

2. What if I specify an independent template for a category or document but do not provide the corresponding template file, how will the system handle it?

AnQiCMS has designed a good fault-tolerant mechanism. If you specify an independent template name for a category or document (for example"), but the actual template folder does not existspecial.html)}special.htmlThe system usually falls back to the default template file for rendering. This is typically the case for document detail pages{模型table}/detail.html; for category list pages, it is{模型table}/list.htmlTherefore, when specifying an independent template, be sure to ensure that the corresponding template file actually exists.

3. Does AnQiCMS support using completely different templates for PC and mobile ends?

Yes, AnQiCMS perfectly supports the use of completely different templates on PC and mobile devices.When you choose a template, you can set the template type to the "PC + mobile independent site" mode.In this mode, you can create within a template packagemobile/Subdirectory. AnQiCMS

Related articles

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 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 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

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

AnQiCMS is designed very clearly and flexibly in template file management, aiming to allow users to customize the appearance and functions 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 front-end development and customization.

2025-11-07

How to retrieve and display the title, detailed content, summary, and recommended attributes of an article (document)?

In Anqi CMS, whether it is to display the detailed content of a single article or to preview multiple articles on the list page, flexibly obtaining and displaying the title, detailed content, introduction, and recommended attributes of the article is the foundation of website operation.The design of Anqi CMS makes this process intuitive and efficient, we mainly achieve it through template tags and variable calls.First, understand the template system of Anqi CMS is crucial.

2025-11-07

How to effectively retrieve and display a thumbnail, cover main image, or a collection of multiple images for an article?

In content operation, captivating images are an indispensable element to attract readers and enhance the quality of articles.AnQiCMS (AnQiCMS) understands this and provides a diverse and flexible set of features, whether it's for the thumbnails of article lists, the cover images on detailed pages, or rich multi-image collections, all can be easily obtained and displayed in the way you expect.How does AnQi CMS handle various images?In AnQi CMS, images are usually divided into several types to meet the display needs of different scenarios: * **Article Thumbnail (Thumb):**

2025-11-07

How to implement the pagination display function of AnQiCMS article list, as well as how to customize the pagination style and logic?

In content operation, the pagination display of the article list is a basic and crucial function, which not only affects the user's browsing experience, but also is closely related to the performance and SEO performance of the website.AnQiCMS as an efficient and customizable content management system provides us with a flexible way to implement and beautify the pagination function of the article list.

2025-11-07

How to get and display the title and link of the previous and next articles on the article detail page?

It is crucial to provide a smooth user experience in the operation of our website.When a visitor finishes reading a rich article, they often want to follow the trail and continue browsing other content in the same category or related topics.In this case, it is particularly important to display the titles and links of the previous and next articles on the article detail page.

2025-11-07