How to independently configure content display templates for each site under multi-site management?

Calendar 81

In the Anqi CMS multi-site management system, configuring a dedicated content display template for each site is the key to achieving brand differentiation, optimizing user experience, and meeting specific content display needs.The Anqi CMS, with its flexible architectural design, provides multiple ways to achieve this goal, whether it is from the overall site level or refined to specific content types, it can achieve a high degree of customization.

Understanding the template mechanism of Anqi CMS

Firstly, we need to understand how Anqi CMS organizes and manages templates. All sites share a core template management area, usually located under the system root directory./templateFolder. In this directory, you can create multiple independent template packages (also known as template themes), each package is an independent folder, containing a complete set of styles, scripts, images, and the most important.htmlTemplate file.

Each template package is defined by aconfig.jsonfile to specify its basic information, such as the template name (name), a unique package identifier (package), version number, description, and template type (template_typeThe template type determines whether the template is for responsive design, code adaptation, or independent PC and mobile versions.AnQiCMS uses a syntax similar to the Django template engine, making the writing of template files intuitive and powerful.

The core path of independent template configuration for multiple sites

AnQi CMS provides multi-level template configuration capabilities from global to local, ensuring that each site can have a unique appearance and functionality.

1. Bind a dedicated template when creating a new site

This is the starting point for implementing independent multi-site templates. When you go to the Anqi CMS backend to perform "multi-site management" and "add a new site", the system will provide an option for you to "select the template to be used for the new site".Here, you can start from/templateSelect one from all the installed template packages in the directory as the default theme for the new site.Once selected and created successfully, the site will completely use this template for content display.This means that even multiple sites running on the same server can present completely different visual styles and layouts as long as they are bound to different template packages.

2. Template directory structure and default content type template

Each template package has its recommended directory structure, for example:

  • index/index.htmlFor the home page of the site.
  • {模型table}/detail.htmlFor the detail page of specific content models (such as articles, products).
  • {模型table}/list.htmlFor the list page of specific content models.
  • page/detail.htmlFor the detail page of a regular single page.
  • If mobile template is enabled, there will be anmobile/subdirectory containing mobile exclusive template files.

These default template files are the basis of the specific site template package. This means that all articles within the same site, unless specially specified, will use the template package bound within.article/detail.htmlThis hierarchical design ensures the consistency of content display within the site.

3. Template coverage for specific content types

The strength of AnQi CMS also lies in its fine-grained template coverage mechanism.After selecting the default template at the site level, you can also specify a more personalized template for specific content.The priority of this mechanism is usually: the specified template for individual content items > the specified template for categories > the default template for the site.

  • Specify exclusive list templates for categories:In the "Content Management" under the "Document Category" settings, each category can be configured with a "Category Template" field. If you want the article list or product list page under a certain category to have a unique layout, you can fill in the corresponding template file name here (for exampledownload.html)。The system will prioritize using the specified template for rendering the content list under this category.In addition, you can also choose to apply this template setting to subcategories, so that lower-level categories inherit this setting.

  • Specify a dedicated details template for a single document or product:In the "Content Management" "Add Document" or "Edit Document" interface, there will be a "Document Template" field. When you need a specific article or product detail page to have a unique display effect, you can directly enter the template filename here (for examplespecial_product_detail.html). This document will no longer use the default detail template of its category or site, but will use the exclusive template you specify.

  • Specify an exclusive template for a single page:Similarly, the "Page Resources" under "Page Management" provides the "Single Page Template" field.This allows you to configure completely independent display templates for specific single pages such as 'About Us', 'Contact Information', etc., thus providing flexibility to meet different page requirements.

Useful Techniques in Template Creation

When creating independent templates for multiple sites, the following techniques can help you improve efficiency and maintainability:

  • Utilize common code snippets:For elements such as headers, footers, sidebars, etc. that may be repeated on multiple pages or in multiple template packages, you can use{% include "partial/header.html" %}Tag to introduce independent public files, avoid repetition.
  • Inherit the basic layout:apply{% extends 'base.html' %}and{% block content %}Tags, you can design a basic layout (skeleton) and then let other templates inherit this layout, only rewriting the parts that need customization to maintain a unified style and reduce redundancy.
  • Use macros to simplify repeated elements:For some UI components with high repetition but different parameters, you can use:{% macro %}Tags define reusable code blocks and call them where needed, such as{{ archive_detail(item) }}.
  • Mobile independent template:If your template type is the "PC+Mobile" independent mode, be sure to include in each template package'smobile/Build the corresponding mobile template files under the directory and ensure a **browser experience on different devices.

Through the above multi-level configuration and flexible template mechanism, Anqi CMS can allow you to easily implement independent template configuration for each site under multi-site management, thereby effectively supporting diverse business needs and brand strategies.


Frequently Asked Questions (FAQ)

Q1: Have I created multiple sites, and will modifying a template package affect other sites?A1: It depends on whether other sites are also using the same template package.If you modify a site-specific template package, it will only affect that site.But if multiple sites share the same template package (the same template was selected when creating a new site), then any modifications to the template package will affect all sites using it at the same time.It is recommended to create and bind an independent template package for each site that needs an independent style to avoid unnecessary mutual influence.

Q2: Is there a set of default template naming rules in Anqi CMS specified in the background?A2: Yes, AnQi CMS supports a set of default template file naming rules. When you do not specify a template in the background for specific content items (such as documents, categories, single pages), the system will automatically search for these default-named template files. For example, the article detail page will try to find{模型table}/detail.html, article list page will search{模型table}/list.htmlor{模型table}/list-{分类id}.html, single page will searchpage/detail.htmlorpage/detail-{单页ID}.html. Understanding these rules helps you organize template files and implement template application without additional background configuration.

Q3: I want to use the same specific detail page template for all articles under a certain category (content model is "article"), how should I operate?A3: You can enter the "Content Management" -> "Document Category" interface on the Anqi CMS backend, find the corresponding category to edit.In the category editing page, there is a "document template" field.Enter the file name of the detail page template you want to use for all articles in this category (for examplearticle_special_detail.htmlAfter saving, all articles in this category (unless the article itself specifies a more specific template) will be displayed using this template uniformly.If you also want its child categories to inherit this setting, you can check the 'Apply to child categories' option.

Related articles

How to control the display of different content models (such as articles, products) on the front end?

In AnQi CMS, flexibly controlling the display methods of different content models (such as articles, products, cases, etc.) on the front end of the website is the key to improving user experience and meeting diverse business needs.The system provides a powerful and easy-to-understand mechanism that allows you to finely design and manage the presentation effect of the page according to the content type and specific needs. ### Understanding the Basic Role of Content Models Firstly, we need to understand the core position of the content model in the Anqi CMS. The content model is not only defined by the structure of the content, but also determines what data you can collect for different types of content

2025-11-09

How to customize the display layout of the article detail page in AnQiCMS?

In website operation, the article detail page is not just a carrier of content, but also a key link for brand image, user experience, and SEO effect.A well-designed and logically organized detail page that can effectively increase user reading time, reduce bounce rate, and help search engines better understand and crawl content.For friends using AnQiCMS, deeply customizing the display layout of the article detail page is actually more flexible and convenient than you imagine.AnQiCMS as an efficient content management system, deeply understands the needs of content operators

2025-11-09

How to display user group (VIP system) information in AnQiCMS to support member level display?

In today's internet world, the member system of websites and user grouping functions have become increasingly common. It not only helps operators provide differentiated services, but also is an important means to realize content monetization and enhance user stickiness.AnQi CMS knows this, therefore it has built a powerful user group management and VIP system, allowing the website to flexibly provide customized content and permissions for different user groups.How can we clearly display user group information (that is, VIP level) on the front-end page of a website built with Anqi CMS?This is actually more direct than imagined

2025-11-09

How to use the `lorem` tag to generate placeholder text in the early stages of development, and quickly preview the display effect of the template?

At the early stage of website template development, designers and developers often face a common challenge: how to effectively preview and adjust the layout, style, and responsive performance of the template without real content?If each modification requires manual input of a large amount of text to test the effect, it will undoubtedly greatly reduce development efficiency.AnQi CMS knows this pain point and provides a very convenient and efficient built-in tag called `lorem`, which can help us quickly generate placeholder text during the development stage, so that we can focus on the visual presentation of the template itself.### `lorem`

2025-11-09

How to display thumbnails, titles, and summaries in the article list?

In website operation, how to display the content list efficiently and beautifully is the key to attracting users and increasing the number of visits.A clear display of a thumbnail, title, and introduction of an article list, not only can it help visitors find the content they are interested in at a glance, but it can also effectively improve the website's performance in search engines.AnQiCMS provides rich features and a flexible template system, allowing us to easily achieve such effects.How is the content of the article managed in the AnQiCMS backend?Display thumbnails, titles, and summaries in the article list

2025-11-09

How to filter and display a list of specific content based on recommendation attributes (such as "Headline

When operating a website, we often need to highlight certain important or recommended content, such as placing the latest news at the "top" or marking popular products as "recommended".AnQiCMS provides a flexible recommendation feature that allows you to easily filter and display these specific contents, thereby better guiding users to browse and enhance the value of the content. ### Understanding Recommendation Attributes and Their Functions The recommendation attributes in AnQiCMS can be considered as a special tag for content, used to mark its importance and display method on the website.These properties are rich in variety, for example: *

2025-11-09

What device adaptation modes does AnQiCMS support to optimize content display?

With the popularization of mobile internet, the types of devices used by users to access websites are becoming increasingly diverse, ranging from large-screen PC monitors to compact smartphones. The display effect of website content is directly related to user experience and the effective transmission of information.AnQiCMS is well-versed in this field, providing a variety of device adaptation modes to help users flexibly optimize content display and ensure that the website presents a**status**on any device.The device adaptation strategy of AnQi CMS is mainly divided into three types, each mode has its unique implementation method and applicable scenario

2025-11-09

How to set and optimize the static URL structure of a website to enhance the display effect in search engines?

The importance of website operation and URL structure is self-evident.A clear and meaningful URL not only helps users better understand the page content, but is also a key factor in search engine optimization (SEO).Especially for content management systems, properly setting up the pseudo-static URL structure can significantly improve the display effect and user experience of the website in search engines.AnQiCMS as a content management system that focuses on SEO optimization, provides strong and flexible support in this aspect.It not only built-in a variety of commonly used pseudo-static rules

2025-11-09