How to set up a separate display template for specific documents, categories, or single pages in AnQi CMS?

Calendar 👁️ 65

In website operation, we often need to present unique design or functional layout for specific content (whether it is detailed documents, entire category pages, or independent single pages).AnQi CMS provides a flexible mechanism that allows users to easily specify independent display templates for this content, thereby achieving highly personalized website display effects.

To understand how to set up an independent template, we first need to have a basic understanding of the template mechanism of Anqi CMS. In Anqi CMS, the template files of the website are usually stored in/templateUnder the directory, each topic has its own independent folder. These template files are used to define the structure, style, and content display of web pages in HTML.The system will automatically match the default template based on URL path, content type, and other information, for example, the article detail page may usearticle/detail.html, for the category list pagearticle/list.htmlWhen the default template fails to meet specific needs, an independent template comes into play.

Set an independent display template for a specific document.

If you have an important announcement, a special product introduction, or an article that requires a unique layout style, you can specify a unique template for it.

When you enter the AnQi CMS backend management interface, click on 'Content Management' under 'Publish Document' or edit an existing document, you will see a form with various settings.Scroll down to find the collapsible area called "Other Parameters".Expand it, and you will find a text box named "Document Template".Here, you can directly enter the custom template file name you want to use for this document.

For example, if you have designed a special template nameddownload.htmlin the 'Document template' input box.download.htmlAs soon as it is done. When the system accesses this document, it will call the one you specifieddownload.htmlto render the page content, instead of using the default document detail template of the model.

Set an independent display template for a specific category

The category page is usually used to display a series of related content, such as a product line or service project.If you want the list page of a category to have a unique layout, for example, a special topic page or a product guide page, you can also set a template separately.

Navigate to the "Content Management" under "Document Category" in the background, select the category you need to edit.In the category editing page, in the "Other Parameters" area, you will find a "Category Template" field.Here, you can enter the template filename designed for this category, such asproduct-showcase.html.

It is worth mentioning that the category template settings also have an option for 'Apply to subcategories'.Tick this option, all subcategories under this category (if they do not have an independent template themselves) will follow this custom template. This is very helpful for maintaining a unified style of content display for specific business lines.

Set an independent display template for a specific single page

A single page, such as 'About Us', 'Contact Us', or 'Terms of Service', etc., often carries key information of the website, and its design may need to be completely different from blog articles or product list pages.

Log in to the background, go to 'Page Resources' under 'Page Management', and select or create your single page.In the form of editing a single page, you will also find a setting item for 'Single Page Template'.Enter the name of your custom template file, for exampleabout-us-v2.html. The system will use the file you specified to display content when accessing this single page. This provides great flexibility for creating highly customized landing pages or company profile pages.

Key points to note

When using this feature, there are several important points to keep in mind:

  1. The template file must exist:No matter whether you are setting a custom template for documents, categories, or single pages, the most important thing is that the template file you fill in must truly exist in the theme folder you are currently using.If the file does not exist, the page will not display normally, and error messages may appear.
  2. File location:Generally, these custom template files are placed in your theme directory (for example,/template/default/The root directory, or the subdirectory corresponding to the content type under the topic (for examplearticle//product//page/). The system will try to find the file you specified at a reasonable location.
  3. Naming suggestion:Name your custom template file clearly and meaningfully, for examplespecial-promo.htmlinstead oftemp1.htmlThis helps you better manage and maintain the website.
  4. Priority:The independently set template in the background takes precedence over the system default template rules. This means that even if there is a default templatearticle/detail.htmlif you specify a template for a documentmy-unique-article.htmlSo the system will use the latter.
  5. Thorough testing:After each setting or change of the custom template, be sure to visit the corresponding page on the front end to ensure that the template is loaded correctly and the content is displayed correctly.

By following these steps and precautions, you can fully utilize the template customization capabilities of Anqi CMS to create unique user experiences for different parts of the website.


Frequently Asked Questions (FAQ)

Q1: What will happen if I set a custom template but forget to upload the template file to the server?A1: If the custom template file you specified does not exist on the server, when accessing the corresponding page, the AnQiCMS system will not be able to find the template file to render, which will usually display an error page or a default system error prompt, causing the page content to be displayed normally.Therefore, make sure to set the custom template name in the background after which, upload the corresponding template file correctly to the template directory of the currently enabled theme.

Q2: Can I set a custom template for a category and also set another template for a specific document under that category? Which one will take effect?A2: It's okay. In this case, the custom template set at the document level takes precedence over the template set at the category level.That is to say, if Category A uses template A, and document 1 under Category A uses template B, then document 1 will use template B when accessed, and other documents under Category A (without a separately set template) will use template A when accessed.

Q3: Where should my custom template file be placed in the theme directory?A3: Generally, you can place the custom template files directly in the root directory of the theme you are currently using (for example/template/你的主题名/)。AnQiCMS looks for templates by intelligently matching content types and template names.But for better organization and management, you can also place it in the corresponding model subdirectory under the theme, for example, the template related to articles can be placed inarticle/folder, and the templates related to single pages are placed inpage/In the folder. As long as the name you fill in the "Document Template", "Category Template", or "Single Page Template" fields in the background matches the file path (if it is not in the root directory of the theme, then it needs to include the subdirectory name, such aspage/about-us.html)Match it.

Related articles

How to handle the UTF-8 encoding of Anqi CMS template to avoid garbled display of website content?

When using Anqi CMS to manage website content, you may occasionally encounter situations where乱码 appear on the page, which is usually related to the encoding settings of the template file.The AnQi CMS has specific requirements for the encoding of template files - it must use UTF-8 encoding uniformly.Understanding and properly handling this stage is the key to ensuring that the website content is displayed normally and provides a good browsing experience. Why do character codes appear乱码?

2025-11-07

In Anqi CMS template, how are `{{variable}}` and `{% tags %}` used for displaying dynamic content and logical control?

AnQiCMS with its high efficiency and flexibility has become a good helper for content management.The presentation of website content cannot do without templates, and in the AnQiCMS template system, `{{variable}}` and `{% tag %}` are the core elements for building dynamic pages and realizing powerful functions.They each have different responsibilities, and they collaborate closely to make our website content vibrant. --- ### `{{variable}}`:The intuitive presentation of data Imagine what you want to display on the page, such as the title of an article or the name of a website.

2025-11-07

How to reference static resources (such as CSS/JS/images) in AnQi CMS template to beautify content display?

In content operation, the aesthetics and user experience of the website are crucial, and this largely depends on the reasonable use and management of static resources (such as CSS stylesheets, JavaScript scripts, and images).For users who use AnQiCMS, mastering how to efficiently and standardizedly refer to these resources in templates is a key step to building a high-quality website.

2025-11-07

What is the organization method of the AnQi CMS template file to ensure the correct loading and display of content?

In AnQiCMS (AnQiCMS), the organization of template files is directly related to the correct loading, display efficiency, and subsequent maintenance convenience of website content.A clear and reasonable template structure that allows you to handle complex content display requirements with ease and greatly enhances team collaboration efficiency.The AnQi CMS uses Go language as the development foundation, its template engine syntax is similar to Django, which provides powerful and flexible tools for template developers.Understanding its core principles and following certain organizational standards will make your website operation twice as effective.

2025-11-07

How to create and store a mobile template in Anqi CMS to ensure the normal display of a mobile website?

Build and manage mobile templates in AnQiCMS to ensure your website displays correctly on mobile devices, you need to understand its flexible template adaptation mechanism and clear file storage rules.AnQiCMS provides various mobile adaptation modes, allowing you to choose the most suitable method according to your actual needs. ### Understanding AnQiCMS' Mobile Adaptation Mode Firstly, we need to understand the three main mobile adaptation modes supported by AnQiCMS: 1.

2025-11-07

How to display detailed information of a specific document in the Anqi CMS template, including the title, content, and thumbnail?

In AnQi CMS, sometimes we may need to display detailed information of a preset document at a specific location on the website, such as a recommendation area on the homepage or the '精选内容' module in the sidebar, including its title, content, and an eye-catching thumbnail.To achieve this goal, Anqi CMS provides a very flexible and intuitive way.

2025-11-07

How to use the `archiveList` tag to flexibly build various document lists and pagination display in Anqi CMS?

Manage and display content is a core operation in Anqi CMS, where the `archiveList` tag plays a crucial role.It can not only help us flexibly present lists of various documents such as articles, products, etc., but also seamlessly connect with the pagination function, meeting various complex content display needs.## Getting to Know the `archiveList` Tag: A Tool for Displaying Content The `archiveList` tag is a core tool in the Anqi CMS template used to retrieve document lists.

2025-11-07

How to use the `archiveFilters` tag to add advanced filtering functionality to the document list of AnQi CMS?

Manage content in Anqi CMS, especially when the website content becomes rich, how to help visitors quickly find the information they need has become the key to improving user experience.If your website offers a diverse range of products or services, or contains a large number of articles with different attributes, then an efficient filtering function will be essential.Today, let's delve into a very useful tag in Anqi CMS, `archiveFilters`, which helps us easily add advanced filtering features to the document list.The foundation of the flexible content model

2025-11-07