Explore the multi-site architecture of AnQiCMS

AnQiCMS is positioned to serve small and medium-sized enterprises, self-media operators, and users with multi-site management needs.The core function of its one is the multi-site management, which allows users to create and independently manage multiple websites under the same system architecture.This means you can control multiple seemingly independent digital assets through a unified backend interface.

In AnQiCMS's multi-site design philosophy, each site is considered an independent entity.When deploying in practice, especially when adding new sites through methods like Docker, the system will allocate an independent site root directory for each new site (used for storing cache, static files, etc.) and an independent database.This architecture ensures the high isolation and security of each site's data, avoiding data pollution between different sites, and also provides a foundation for site customization.Although the data is stored independently physically, AnQiCMS cleverly builds a bridge for data sharing at the logical level.

The core mechanism of cross-site data sharing

AnQiCMS实现跨站点数据共享的核心,在于其灵活且强大的模板标签体系。系统的大多数内容类模板标签,如文档列表 ("EnglisharchiveList)、分类列表 (English)categoryList)、单页列表 (English)pageList)、友情链接 (English)linkList),乃至系统配置信息 (English)system) 和联系方式 (English)contact) 等,all built-in a key parameter——siteId.

Through thissiteIdParameters, operators can easily specify and call data from other sites managed by the same AnQiCMS instance in a template of a site.This mechanism is not a simple data copy or synchronization, but a real-time, on-demand data retrieval capability.siteIdIt will query the data source of the target site and return the corresponding data, greatly enhancing the reusability of content and the interconnectivity of the site.

For example, a company may have a main brand official website and multiple sub-brand product sites.siteId,Main brand website can aggregate and display all product introductions of sub-brands, or a product station can refer to the contact information or general news announcements of the main website without manually copying and pasting content, or through complex API interfaces for data transmission.This design avoids the common repetitive work and data inconsistency problems in traditional multi-site solutions.

Example of template tag usage

To better understandsiteIdThe strength of it, we can imagine some specific template code snippets. Suppose your AnQiCMS manages two sites: Site A (siteId=1, the main brand official website) and Site B (siteId=2,Product line B's independent website).

If the standalone site (site B) of the product line B needs to display the latest news articles of the main brand's official website (site A) on the homepage, you can call it like this in the template of site B:

{# 在站点B的模板中调用站点A的最新文章列表 #}
<div>
    <h3>来自主品牌官网的最新新闻</h3>
    {% archiveList latestNews from siteId="1" type="list" limit="5" %}
        {% for item in latestNews %}
            <p><a href="{{item.Link}}">{{item.Title}}</a> - {{stampToDate(item.CreatedTime, "2006-01-02")}}</p>
        {% endfor %}
    {% else %}
        <p>暂时没有来自主品牌官网的新闻。</p>
    {% endarchiveList %}
</div>

Similarly, if the main brand's official website (site A) wants to display all product categories of sub-brand sites (including site B) on a single page, it can also do so bysiteIdParameter traversal or specification:

{# 在站点A的模板中调用站点B的产品分类列表 #}
<div>
    <h3>产品线B的分类</h3>
    {% categoryList productBCategories from siteId="2" parentId="0" %}
        <ul>
            {% for category in productBCategories %}
                <li><a href="{{category.Link}}">{{category.Title}}</a></li>
            {% endfor %}
        </ul>
    {% else %}
        <p>产品线B暂时没有可用分类。</p>
    {% endcategoryList %}
</div>

Even, you can retrieve specific system configuration information across sites, for example, get the contact information of the main site and display it on the sub-site:

{# 在子站点模板中调用主站点的联系电话 #}
<div>
    联系我们:<a href="tel:{% contact with name='Cellphone' siteId='1' %}">{% contact with name='Cellphone' siteId='1' %}</a>
</div>

These examples clearly demonstratesiteIdHow to break the boundaries between sites, allowing data to flow efficiently between different sites managed by AnQiCMS.

Advantages and considerations

AnQiCMS's cross-site data sharing mechanism brings significant advantages:

  • Content reuse and consistency:Avoided the repeated creation of content across multiple sites, ensuring consistency of core information, while also saving a significant amount of operational time.
  • Unified management and collaboration:Even though the data is stored independently, managing all sites and their content through a set of CMS systems simplifies team collaboration and the content publishing process.
  • Flexible application scenarios:Whether it is to build an enterprise portal, a product matrix, a multilingual website, or a content aggregation platform, this capability provides great flexibility.

However, while enjoying these conveniences, one also needs to pay attention to some considerations:

  • Data ownership and permissions:Even though they can be shared, each site still "owns" its own data. Clear boundaries should be maintained in data modification and permission management.
  • Performance impact:Cross-site data calls will involve additional database queries.For high-traffic, frequently cross-site call scenarios, optimization of the template and data query is required to ensure the website response speed.AnQiCMS is developed based on the Go language, and its high concurrency and high-performance underlying architecture to some extent alleviates this problem.
  • SEO strategy:When sharing content across sites, it is important to avoid potential duplicate content issues and plan reasonably with SEO tools such as Canonical tags, Robots.txt, etc. to guide search engines to correctly index.

In summary, the multi-site function of AnQiCMS is not just a simple stacking of multiple websites, but throughsiteIdThis core mechanism, while maintaining data independence, achieves flexible sharing and integration of content between sites.This provides powerful content management tools for operations personnel, enabling them to build and operate complex website ecosystems more efficiently and strategically.

Common Questions and Answers (FAQ)

1. Does the multi-site function of AnQiCMS support synchronizing the content of one site directly to another, rather than just through template calls?AnQiCMS的多站点功能主要通过模板标签的 EnglishsiteIdThe parameter implements "data sharing", meaning loading and displaying data from another site on a single site.This is a read operation, not automatically copying or synchronizing data to the database of the target site.If you want to achieve physical data synchronization, it may be necessary to implement it through the AnQiCMS API interface or custom development.

2. In multi-site mode, does each site have to use an independent database? Will this increase the complexity of deployment and maintenance?Yes, according to AnQiCMS design, each new site created under the same AnQiCMS instance will have an independent database.This helps with data isolation and management, but does indeed mean that the number of database instances will increase.However, AnQiCMS simplifies this process, for example, when deploying with Docker, you can choose to reuse database account information, thereby reducing the complexity of configuration.For high-performance architecture in Go language development, managing multiple database instances will not significantly increase performance overhead.

3. If my multisite contains websites in different languages, how does AnQiCMS's data sharing feature work with multilingual support?siteId数据共享功能如何配合多语言支持?AnQiCMS supports multi-language functionality, each site can be configured with its default language package.siteIdThe parameter is mainly used for cross-site calling of original data content (such as article titles, content, etc.). For multi-language sites, you usually have each language site (corresponding to an independentsiteId站点(English)上分别维护翻译后的内容。通过siteIdThe content you will get when calling is specific to the target site's language. If you need to display content in other language versions, it should be on the corresponding language site (with the relevantsiteIdThe template is called in.