How to set up independent templates for specific articles, categories, or single pages to achieve customized content display?

Calendar 👁️ 68

In website operation, we always encounter some unique content, which may represent a special promotional activity, an important corporate report, or a page that needs to be presented specially.This content often does not meet the unified default style of the website, and needs its own 'face' to attract users and highlight the key points.AnQiCMS (AnQiCMS) understands this need and therefore provides a very flexible template customization feature, allowing us to easily set independent templates for specific articles, categories, or single pages, thus achieving customized content display.

Why do you need an independent template?

Imagine that most of the content on your website is regular articles, and a simple template is enough to display them.But suddenly, you need to publish an annual report, which may contain a large number of charts and videos, and requires a wider and more interactive layout;Or do you want to create a dedicated introduction page for a product series, with an entirely different layout, button, and image display style from the ordinary product detail page.For example, "About Us" or "Contact Us" pages of this kind, their content and structure are fixed, often requiring a unique brand display style.

In this case, if only the default template can be used, the website content will seem monotonous and will not highlight the value of specific information.The independent template function of AnQi CMS is specifically designed to solve this pain point, so that every piece of content can be presented to visitors in the most suitable way.

The basic storage and naming rules of template files

All template files are stored in the root directory of Anqi CMS/templateIn the folder. Each set of templates has its own subdirectory, for exampledefaultThe template is located in/template/default. The custom template file you create is usually also named with.htmlsuffix.

The AnqiCMS template engine supports Django template engine syntax, which is very easy to use. It also provides some default naming conventions based on content ID or category ID, which is itself a convenient way to customize:

  • Document (article/product) detail page:You can create a name called{模型table}/{文档id}.htmltemplate, for examplearticle/123.html, the system will automatically recognize and apply it to the article with ID 123.
  • Category list page:can create{模型table}/list-{分类id}.htmlOf the template, for exampleproduct/list-45.htmlThis product category list page with ID 45 will automatically use this template.
  • Single page detail page:Similarly,page/{单页面id}.htmlSuch a naming, such aspage/7.htmlCan automatically customize the single page with ID 7.

In addition to these automatically recognized naming methods, you can also customize more descriptive template filenames as needed, for examplearticle/special_event.htmlorpage/about_us.html. Let's see how to associate these custom templates with your content in the background.

Apply an independent template to specific content in the background.

The AnQi CMS backend interface design is intuitive, and it is very convenient to associate custom templates with content.You only need to find the corresponding 'template' setting item when editing the corresponding article, category, or single page and fill in the name of the template file you have prepared.

1. Set an independent template for a specific article (or product)

When you need a specific article (or product detail page) to have a unique display style:

  • First, create the corresponding template file in your template directory, for examplearticle/annual_report.html.
  • Then, log in to the Anqi CMS backend, go toContent Management, selectPublish documentoredit documents.
  • Find at the bottom of the editing page,.and expand the collapsible area.
  • You will see a field namedDocument TemplateThe input box. Here, enter the custom template filename, for exampleannual_report.htmlPlease note that you only need to enter the filename, not include/article/Such a model directory prefix, the system will automatically recognize.
  • After saving, the detail page of this document will use the one you specified.annual_report.htmlThe template will be displayed.

2. Set an independent template for a specific category.

If you want all the content under a certain category (including the category list page and the article detail page of that category) to have a unified custom style, you can set it at the category level:

  • Similarly, first create the custom template file, for example, for the list pagecategory/promo_list.htmlas well as the article detail page under the categoryarticle/promo_detail.html.
  • Log in to the AnQi CMS backend, go toContent Management, selectDocument Category.
  • Select the category you need to customize, clickEdit.
  • On the editing page,.you will see two important template settings:
    • Category template:This is used to customize the current category list page. For example, you can fill inpromo_list.html.
    • Document template:This is used to customize the detail page of all articles (or products) under the current category. For example, you can fill inpromo_detail.html.
  • There is anotherApply to subcategoryThe option. If you want this setting to also apply to all subcategories of the current category, remember to check it.
  • After saving the changes, the display of this category and its (if checked) subcategory content will be according to your settings.

3. Set an independent template for a specific single page.

For independent single pages such as "About Us", "Service Introduction", etc., the steps to customize the template are similar to those for articles, and are very straightforward:

  • First, prepare your single-page template file, such aspage/contact_us.html.
  • Log in to the AnQi CMS backend, go toPage Resources, selectPage Management.
  • Select the single-page you need to customize and clickEdit.
  • Find at the bottom of the editing page,Single page templateInput box.
  • Enter the custom template filename you want, for examplecontact_us.html.
  • After saving, this single page will be displayed in the exclusive style you designed.

Content displayed in the custom template.

Once you have set up an independent template for specific content, you can fully utilize the powerful Django template engine syntax and built-in tags of Anqi CMS in these template files to build the content. Whether it is the article detail page of{% archiveDetail %}Tags to get the content of the article and custom fields, or the category list page's{% archiveList %}Tags to loop through the article list, or in a single page's{% pageDetail %}Labels, these can help you flexibly display the required data, achieving truly customized content presentation. You can also combine conditional judgment{% if %}Loop traversal, such as{% for %}and various filters, making the logic and display of the template more rich.

In this way, Anqi CMS not only provides a stable and efficient content management foundation, but also gives us the ability to give more vitality and unique charm to the website content.Say goodbye to the same old, start customizing your exclusive template!


Frequently Asked Questions (FAQ)

1. What will happen to the website if the custom template file I specify for articles/categories/singles pages does not exist?If the specified template file does not exist, the system will not be able to find the corresponding template to render the page, which usually leads to the page displaying errors or being inaccessible. Therefore, be sure to ensure that the corresponding template exists before filling in a custom template name in the background..htmlThe file has been created correctly and placed in the template directory.

2. What is the difference between 'Category Template' and 'Document Template' in the category template?'Category Template' is used to define the category.list pageThe display style, such as the news list page you accessyourdomain.com/category/newswhen you see. 'Document template' is used to define the category belowdetails page for all articles (or products)The display style, such as the content you see after clicking on a news item in the news listyourdomain.com/article/news-item-1Page. By setting these two options, you can control the display of the category list and the specific content within the list.

3. What security CMS features can I use in a custom template to dynamically display content?You can fully utilize the powerful template tags and filters of Anqi CMS in your custom template. For example, use `{%

Related articles

How to correctly reference and display variables in AnQiCMS templates and make conditional judgments to control content display?

In AnQiCMS templates, flexibly referencing variables and using conditional judgments to control content display is the key to building dynamic and feature-rich websites.AnQiCMS uses a template engine syntax similar to Django, making template development both intuitive and powerful.This article will delve into how to effectively manage variables and logic in the AnQiCMS template, helping you better control the presentation of content.--- ## One, AnQiCMS template basics: variable reference and display In AnQiCMS template

2025-11-08

What website modes does AnQiCMS support to meet the display needs of adaptive, code adaptation, or independent sites for PC+mobile?

In today's multi-screen interconnected digital age, whether a website can present excellent display effects on various devices is directly related to user experience, brand image, and even business conversion.AnQiCMS as an efficient and flexible content management system fully understands this core need, providing users with a variety of website display modes to ensure that your content reaches the target audience perfectly on any terminal.AnQiCMS has carefully designed three mainstream website models to meet the display needs of adaptive, code adaptation, or independent sites for PC and mobile endpoints

2025-11-08

How can AnQiCMS significantly improve website loading speed and content display efficiency through static caching and SEO optimization?

In today's fast-paced online world, slow website loading speed not only drives away visitors but may also make your content 'disappear' in search engines.User experience and search engine optimization (SEO) are the two cornerstones of website success, and both are closely related to the website's response speed and content display efficiency.AnQiCMS is a content management system developed based on the Go language, fully aware of these pain points, and therefore, from the very beginning of its design, it has taken static caching and SEO optimization as core advantages, aiming to significantly improve the performance of the website.

2025-11-08

How do website operators understand the display data of website traffic and spider crawling through the AnQiCMS backend?

## Mastering AnQiCMS Backstage: Understanding Website Traffic and Crawler Extraction Dynamics In today's digital marketing environment, understanding the performance of website traffic and the crawling situation of search engine spiders is crucial for website operators.This not only helps us evaluate the effectiveness of content strategy, but also enables us to detect and resolve potential SEO problems in a timely manner.AnQiCMS is a powerful content management system that provides users with intuitive and detailed backend data, allowing us to easily grasp these key information.

2025-11-08

How to call and categorize the recommended attributes (such as headlines, sliders) of AnQiCMS articles on the frontend?

How to make important and excellent content stand out and attract users' attention at the first time is the key to improving user experience and content marketing effectiveness in website operation.AnQiCMS provides a very practical recommendation attribute mechanism, which helps us easily classify and highlight content, such as setting hot articles as 'Headlines' or displaying selected products in the 'Slider' area.

2025-11-08

How to use the AnQiCMS timing publishing function to control the display time of content and achieve automated operation?

In the daily work of content operation, maintaining the continuous update and scheduled release of website content is a key factor in attracting users and enhancing brand influence.However, manually publishing content is not only time-consuming, but also limited by the time and energy of operation personnel, especially when it is necessary to target global users, cross-time zones, or carry out a series of content promotions, the challenges are even greater.AnQiCMS (AnQi CMS) precisely understands these pain points, cleverly integrates the powerful timing publishing function, helps you achieve automated content operation, and keep your website always vibrant.

2025-11-08

How to add keywords and Tag tags in article content and display them associated in detail pages or list pages?

In Anqi CMS, effectively utilizing keywords (Keywords) and tags (Tags) is the key to optimizing content structure, improving search engine visibility (SEO), and enhancing user experience.They not only help websites to better organize content, but also guide users to discover more related information.Next, we will delve into how to reasonably add these elements to the article content and ensure they can be displayed correctly on the website's detail page or list page.### One, add keywords to the article content Keywords are words that describe the core theme of the article

2025-11-08

How does AnQiCMS handle the SEO title, standard link, and permanent link of articles, affecting their display in search engines?

In website operation, Search Engine Optimization (SEO) has always been a key link in obtaining natural traffic.How a content management system (CMS) effectively handles the SEO title, link structure, and URL normalization directly determines the visibility and performance of your content in search engines.AnQiCMS (AnQiCMS) is a system focused on enterprise-level content management, providing flexible and powerful tools in these aspects to help us better optimize website content.### Accurately Control Search Results

2025-11-08