Under AnQiCMS multi-site management, how to set up independent templates for different sites to display content?

Calendar 👁️ 61

When operating multiple websites, it is crucial to maintain a unique style and presentation for each site, which not only helps in brand building but also better meets the needs of different audiences.AnQiCMS provides strong support for multi-site management, one of its core strengths being the ability to flexibly set independent templates for each site, making content display more personalized.

AnQiCMS multi-site capability and template basics

AnQiCMS is a content management system developed based on the Go language, and its multi-site management feature is one of the highlights tailored for small and medium-sized enterprises and content operation teams.It allows you to manage multiple brands, sub-sites, or content branches simultaneously, greatly reducing repetitive work.In order for these sites to have unique characteristics in content display, their flexible template engine is the key.

AnQiCMS template system uses a syntax similar to Django template engine, using.htmlAs a template file suffix. All template files are stored in/templateUnder the directory, each independent template package has its own exclusive folder under this directory.This means that as long as you specify a different template package for each site, you can easily achieve visual and layout differentiation.

Specify a set of independent templates for your new site

When you create a new site through the AnQiCMS backend, the system will provide a very intuitive option to select the template that the site will use.In the 'Multi-site Management' feature, after clicking 'Add New Site', you will see a dropdown menu to 'Select the Template to Use'./templatea subfolder under the directory.

For example, if you have a main site and a special site, you can/templatecreate two folders under the directory, such asmain_themeandspecial_topic_themePut different template files in it. When you add the main site, selectmain_themeSelect when adding a special topic sitespecial_topic_themeThey can instantly have a completely different appearance and layout. This is the first and most important step in achieving personalized site display.

Deep customization: template strategy for different levels of content

AnQiCMS's template flexibility is not just about this, it also provides a multi-level content template coverage mechanism, allowing you to finely control the display of content according to your actual needs.

FirstlySite-level general templateEach template package includes some conventional basic template files such asindex.htmlUsed for the homepage,errors/404.htmlUsed for the 404 error page,guestbook/index.htmlUsed for message pages, etc. These are the default general styles of the site. The system will use these general templates first when no specific template is specified for the content.

Next isContent model level template.AnQiCMS supports custom content models (such as article models, product models, etc.), each model can have its own default detail page and list page templates.article/detail.htmlandarticle/list.html, create for product modelproduct/detail.htmlandproduct/list.htmlThis means that all content belonging to the "Article" model will default to using the template under the Article model, and the content of the "Product" model will use the template under the Product model.

Further, you can also proceedCategorization templatethe settings.In the background 'Document Classification' management page, when editing a category, you can find the 'Category Template' option.download_list.htmlUsed to display the content list under the category. The system even allows you to choose whether to apply it to the subcategory, so that the settings of the template can be automatically inherited to the lower-level categories, which is very convenient.

Finally, it isTemplate for detailed page of specific content (document/product/singleton page).This is the finest grain of control.When you edit a specific article, product, or single page, there will be a field for "Document Template" or "Single Page Template" in the "Other Parameters".about_us.html), allowing this content to be displayed using a completely independent template, unrestricted by the model or category it belongs to.

It is very important to understand these hierarchical relationships: the highest priority is given to the specific content detail page template, followed by the category-level template, then the content model-level template, and the lowest priority is the site-level general template.This design allows you to flexibly meet various content display needs, from the macro style of the site to the micro layout of a single article, you can achieve precise control.

Template file organization and coding standards

To ensure that the template can be correctly identified and used by AnQiCMS, it is necessary to follow some file organization and coding standards:

  • Template root directory: All template packages are placed in/templatedirectory.
  • template package structure: Each template package is an independent folder, for example/template/defaultor/template/my_custom_theme.
  • configuration file: Each template package must have one insideconfig.jsonFile, used to describe the template name, version, author, and other information.
  • Static resources: Recommend placing the CSS, JavaScript, images, and other static resources used in the template./public/static/In the corresponding template folder under the directory, for example/public/static/my_custom_theme/css/style.css.
  • Mobile end templateIf your website needs a separate mobile template, you can create one in the template package foldermobile/Subdirectory, and place the mobile-specific template files in it according to the same structure as the PC template.
  • EncodingAll template files should use UTF-8 encoding to avoid garbled characters.
  • SyntaxTemplate files use syntax tags similar to Django, such as{{变量}}Used for output variables,{% 标签 %}Used for logical control.

By reasonably planning template files and flexibly configuring in the background, you will be able to fully utilize the powerful capabilities of AnQiCMS in multi-site management and content display, creating a unique user experience for each website.


Frequently Asked Questions (FAQ)

How do I create a new template package for my multi-site?

To create a new template package, you need to be on the AnQiCMS server's/templateCreate a new folder under the directory, for examplemy_new_theme. Within this new folder, you need to create at least oneconfig.jsonFile used to describe the basic information of this template package, such as name, version, etc. After configuration, when you create a new site or edit the global settings of an existing site in the AnQiCMS background, you will be able to see and select the template you

Related articles

How to use the `archiveDetail` tag to implement lazy loading (LazyLoad) of images in AnQiCMS?

In AnQiCMS, the implementation of content image lazy loading is mainly completed by utilizing a very practical parameter in the `archiveDetail` tag.This feature is designed to optimize website performance and enhance user experience, especially when there are many images in the article content, it can significantly reduce the initial loading time of the page.### Understanding Lazy Loading and Its Working Principle in AnQiCMS Lazy loading is a common web optimization technique that refers to deferring the loading of non-critical resources on a web page (such as large images at the bottom of the page)

2025-11-09

How to customize the URL static rules of AnQiCMS article detail page to improve SEO effect?

## Mastering SEO: How to Customize the URL Static Rules of AnQiCMS Article Detail Page In this era where content is king, the SEO effect of a website is directly related to the exposure and user access of the content.Among them, the URL structure acts as the first checkpoint for communication between a website and a search engine, and its friendliness is crucial.A clear, concise, and descriptive URL can not only help search engines better understand the page content, but also improve user experience and increase click-through rate.AnQiCMS as an enterprise-level content management system focusing on SEO

2025-11-09

How can the advanced SEO tools of AnQi CMS help improve?

In the era of intense digital marketing competition, the search engine ranking of a website directly determines its traffic and business opportunities.For many content operators and small and medium-sized enterprises, a powerful and easy-to-use CMS system is the key to achieving SEO goals.AnQiCMS, as a platform focused on efficient content management, took into account the needs of search engine optimization from the very beginning, built-in a series of advanced SEO tools, aiming to help users improve the visibility and traffic performance of their websites.

2025-11-09

How to optimize URL structure through pseudo-static rules to improve search engines' crawling and ranking display of website content?

In website operation, we all hope that our content can be better discovered by search engines and presented to users in a clear and friendly manner.An important aspect is to optimize the URL structure, making it convey the page theme and convenient for search engines to understand and crawl.The pseudo-static feature of AnQiCMS (AnQiCMS) is the key tool that helps us achieve this goal.Why Is It Important for Websites to Have Static URLs?Imagine two types of URLs: one is `/article.php?id=123&category_id=45'

2025-11-09

How to make full use of the flexible content model feature of AnQiCMS to detail product information

In website content operations, the product detail page is the key link between users and products, and its richness of content, clarity of structure, and flexibility of display directly affect users' purchase decisions and the conversion rate of the website.AnQiCMS (AnQiCMS) provides an ideal solution with its powerful flexible content model features, allowing us to break free from the constraints of traditional CMS fixed fields, and build highly customized, attractive product detail pages based on product characteristics and business needs.### One, Flexible Content Model

2025-11-09

How to use the “Recommended Attributes” feature of Anqi CMS to flexibly display specific content on the front page?

When operating a website, we always hope to prioritize the most important and popular content for visitors, so that the focus area of the website can always present the freshest and most attractive information.Manually updating this content is time-consuming and prone to errors. Fortunately, Anqi CMS provides a very practical 'recommended attribute' feature that allows us to easily achieve flexible content display and automated management.What is the "recommended attribute" feature of Anqi CMS?In simple terms, 'Recommended Properties' is like putting a special tag on your website content

2025-11-09

How to customize the Anqi CMS content model to meet the personalized display needs of different types of content?

Today, with the increasing sophistication of content operation, personalized display of website content has become a key to attracting users and enhancing user experience.AnQiCMS (AnQiCMS) provides us with powerful tools with its flexible content model, allowing us to customize the structure and display of content according to various business needs.This article will delve into how to flexibly use the content model in Anqi CMS, making your website content more distinctive and practical.

2025-11-09

How to configure multi-language content in AnQi CMS to ensure that users of different languages can browse the website normally?

Our Anqi CMS provides an efficient and flexible solution for multilingual content configuration, aimed at helping us easily meet the needs of global content promotion.It cleverly distinguishes between system-level language settings and the localization of website content and templates, allowing us to finely manage content in different languages and ensure that users of different languages can browse the website smoothly.Next, we will learn how to configure multi-language content in Anqi CMS and ensure its smooth operation.### Understanding the multilingual mechanism of AnQi CMS In AnQi CMS

2025-11-09