In website operation, we often encounter such needs: some documents need a unique display method, the article list under a certain category needs a special layout, or a single page needs a unique design.AnQiCMS understands the importance of this personalized need and provides flexible template settings, allowing you to easily set independent display templates for documents, categories, and even single pages.This not only helps you better meet the diversity of content display, but also greatly enhances the user experience and the brand image of the website.

Why do you need an independent display template?

Imagine that your website has both regular news articles and product detail pages that highlight features, as well as some landing pages specifically for event promotion.If all pages follow the same template, it is difficult to distinguish them visually and functionally, and it is also impossible to optimize the presentation of content specifically.

To set an independent template for AnQiCMS documents or categories, it means you can:

  • Strengthen brand image:Specific content (such as company profile, core products) can adopt more brand-characteristic templates to deepen the impression of users.
  • Optimizing user experience: According to the type of content (article, product, event), provide the layout and functions that best match the user's reading and browsing habits.For example, the product page can have large image displays and parameter comparisons, while the news page focuses on text reading.
  • Enhance marketing effectiveness: Create customized landing page templates for specific marketing activities to better guide user conversion.
  • A/B testing and optimization: Try different template layout effects and continuously optimize the content presentation strategy through data analysis.

The template mechanism of AnQiCMS is very flexible, it stores all the template files in./templateUnder the root directory, and with.htmlas the file extension. You just need to create or modify these.htmlfiles and upload them to your theme folder, and you can configure them in the background.

Set a separate display template for a single document

When you need to give a unique appearance to a specific article, product, or document under any model on a website, AnQiCMS provides an intuitive settings entry.

First, you need to create a new one in the template design package you are currently using.htmlTemplate file. For example, if you want to create a dedicated template for a document introducing corporate recruitment, you can name itcareer.html. In thiscareer.htmlIn the file, you can freely design the layout, refer to images, styles, and scripts, and use various template tags provided by AnQiCMS (such asarchiveDetail/systemetc) to dynamically call document content.

The file has been created and uploaded to your template design package (for example/template/您的主题名称/career.html) Next, it is time to apply this template to the specific document.

You need to log in to the AnQiCMS backend, go toContent Management, selectPublish documentor edit an existing document. In the document editing interface, you will see a name calledDocument TemplateThe field. Here, you just need to fill in the template file name you just createdcareer.htmlAnd then. After saving the document, when the user accesses this document, AnQiCMS will automatically load and render itcareer.htmlTemplate, rather than the default document details template.

This setting allows you to easily customize the display of each document, whether it is a special product introduction, a detailed white paper download page, or a promotional content for a limited-time event, you can have a tailored presentation style.

Set an independent display template for the entire category

In addition to customizing for individual documents, AnQiCMS also allows you to set independent display templates for the entire document category.This means that all list pages of articles belonging to this category will use the template you specify, which is very useful for maintaining a unified style of category content, highlighting the theme of the category, or achieving specific list display logic.

The operation process is similar to the document template. First, you need to create a list page template file in your template design package, such asspecial-category-list.htmlIn this file, you can usearchiveListtags to cyclically display the abstracts of articles under the category and design the list layout you expect.

complete the creation and upload of the template file (for example/template/您的主题名称/special-category-list.htmlAfter that, please log in to the AnQiCMS backend and navigate toContent Managementand then clickDocument Category. Find the category you want to set a custom template for and click edit. In the category edit page, you will see a field namedcategory templateThe field. Enter it herespecial-category-list.html.

There is an option to note:Apply to subcategory.By default, the template you set for the parent category will not be automatically inherited by its subcategories.If you want this template to also apply to all subcategories under this category, then please set this option to 'inherit'.special-category-list.htmlTemplate.

In addition, there is a particularly useful feature in the category settings:Document Template. This field allows you toAll documents under this categorySpecify a unified detail page template. This means that if you want all the product detail pages of a certain product series to use the same unique layout, you can set a general document detail template here (for exampleproduct-detail-layout.html), so there is no need to set a template for each product document one by one.

Set an independent display template for a single page.

The single-page feature of AnQiCMS (such as "About UsThis provides great convenience for creating independent pages with unique styles, such as corporate milestone displays, team introductions, or specific promotional landing pages.

And like the document and category, you first need to create a new single-page template file, such ascompany-profile.html, and upload it to your template design package, for example/template/您的主题名称/company-profile.html). In this template, you can fully utilizepageDetailtags to display single page content.

Next, log in to the AnQiCMS backend, enterPage Resources, clickPage Management. Find the single page you want to customize, click edit. Find in the single page editing interfaceSingle page templatefield and enter the name of the template file you createdcompany-profile.htmlAfter saving, the single page will appear to the visitor with the exclusive template you designed.

Practical tips

  • Clear naming conventions:Name your custom template file clearly and descriptively, for exampleproduct-review-detail.htmlorevent-list-new-year.htmlThis makes it easy for you to find and manage them among many template files.
  • Make good use of template inheritance:When creating a custom template, you do not have to start from scratch. AnQiCMS supports the Django template engine syntax in{% extends 'base.html' %}tags. This means you can create a generalbase.htmlA skeletal template that includes the common header, footer, and sidebar elements of the website, and then through the custom template{% block content %}Use tags to fill in or rewrite specific areas of content, greatly improving development efficiency and consistency of templates.
  • Test and back up in a timely manner:Always test the template after modifying or adding it on the front-end page to ensure it displays correctly. At the same time, develop the habit of regularly backing up the template files to prevent unexpected situations.
  • Ensure the template file exists:When specifying the template file name in the background, AnQiCMS will not automatically check if the file exists.If the template file entered does not exist, it will cause the page to fail to open normally.Therefore, please make sure that you have uploaded the template file to the correct path.

This flexible template setting capability provided by AnQiCMS allows the display of website content to be unrestricted by a single layout. You can create a more attractive and feature-rich personalized experience for your website based on your business needs and content characteristics.

Frequently Asked Questions (FAQ)

1. I have set up a custom template filename in the background, but the front-end page won't open. What's the matter?This is usually because the template file you have entered does not exist in your theme folder, or the filename is incorrect. Please carefully check the names you have entered in the fields 'Document Template', 'Category Template', or 'Single Page Template' in the back-end, to ensure that they match the actual files you have uploaded/template/您的主题名称/Under the directory.htmlThe filename is exactly the same, including case.

2. What is the difference between the 'Category Template' and 'Document Template' fields when setting a custom template for categories?“Category Template” field