In website operation, we often need to present unique design or layout of functions for specific content (whether it's detailed documents, entire category pages, or independent single pages).The auto CMS provides a flexible mechanism that allows users to easily specify independent display templates for these contents, thereby achieving a highly personalized website display effect.

To understand how to set up independent templates, 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/templateThe directory contains an independent folder for each topic.These template files are used to define the HTML files that define how the web page structure, style, and content are displayed.article/detail.html, and the category list page usesarticle/list.htmlWhen the default template cannot 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 dedicated template for it.

When you enter the backend management interface of Anqi CMS, 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 labeled "Other Parameters".Open it, and you will find an input box named "Document Template".Here, you can directly enter the custom template filename you want to use for this document.

For example, if you have designed a special template nameddownload.htmlthen enter it in this 'Document Template' input boxdownload.htmlEnglish translation: It will call the document you specified when accessing this document.download.htmlEnglish translation: It uses the file to render the page content instead of the default document detail template provided by the model.

To 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 item.If you want the content list page of a category to have a unique layout, such as a special topic page or a product guide page, you can also set a template separately.

Navigate to 'Content Management' under 'Document Categories' in the background, and select the category you need to edit.In the category editing page, just like in the "Other Parametersproduct-showcase.html.

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

To set an independent display template for a specific single page

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

Go to "Page Resources" under "Page Management" in the background and select or create your single page.In the form of editing a single page, you will also find a "Single Page Template" setting item.about-us-v2.htmlThe system will use the file you specify 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

There are several important points to keep in mind when using this feature:

  1. The template file must exist:Whether you are setting a custom template for documents, categories, or single pages, the most important point is that the template file you fill in must truly exist in the current theme folder you are using.If the file does not exist, the page may not display normally and may show error messages.
  2. File location:In most cases, these custom template files are placed in your theme directory (for example/template/default/) at the root directory, or in the subdirectory corresponding to the content type under the theme (for examplearticle//product//page/)。The system will try to find the specified file at a reasonable location.
  3. Naming suggestion:Give a clear and meaningful name to your custom template file, for examplespecial-promo.htmlInsteadtemp1.htmlThis helps you better manage and maintain the website.
  4. Priority:Templates explicitly set in the background take precedence over the default system template rules. This means that, even if there is a defaultarticle/detail.htmlTemplate, if you specify a document formy-unique-article.htmlthe system will use the latter.
  5. Sufficient testing:Ensure that you visit the corresponding page on the front end after each setting or change to a custom template to ensure that the template loads correctly and the content is displayed correctly.

By following these steps and precautions, you can fully utilize the template customization capabilities of the security CMS, creating a unique user experience for different parts of the website.


Common Questions (FAQ)

Q1: What will happen if I set a custom template but forget to upload this template file to the server?A1: If the custom template file you specified does not exist on the server, the AnQiCMS system will not be able to find the template file to render when accessing the corresponding page. This usually results in an error page or a default system error prompt being displayed, leading to the inability to display the page content normally.Therefore, make sure to set the custom template name in the background and upload the corresponding template file 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: Can it.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 (which have not been set with a separate template) will use Template A.

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 in searching for templates, will match intelligently according to the content type and template name.article/folder, and the templates related to single pages are placed inpage/The folder. As long as the name you enter in the fields of "Document Template", "Category Template", or "Single Page Template" in the background matches the file path (if not in the root directory of the theme, then include the subdirectory name, such aspage/about-us.html)Match it.