When using AnQiCMS for website management, the multi-site feature undoubtedly brings great convenience to users who have multiple brands, sub-sites, or content branches.It allows us to efficiently manage multiple independent websites on a unified backend.However, in actual operation, we sometimes encounter a specific requirement: to display the content of another specific site on a site.For example, the main station wants to refer to some of the latest articles of the child stations, or a special topic station wants to display product information from another cooperative site.

How to specify the content to be displayed for a specific site in a multi-site environment through tag parameters?It has become a key issue.It is fortunate that AnQiCMS considered this cross-site content calling scenario from the beginning of its design and provided a simple and effective solution through its powerful template tag system.

AnQiCMS Multi-site Management Overview

The multi-site management feature of AnQiCMS is one of its core highlights.It allows us to easily create and maintain multiple independent websites under the same system.Each site can have its own domain, content, template, and database (or different prefixes of a shared database), but all operations can be completed through a single backend interface.This design not only reduces the complexity of redundant construction and management of multiple independent CMSs, but also provides a unified platform for content operation and resource integration.

Through multi-site management, we can easily set up corporate websites, product display pages, blogs, marketing special theme pages, and various other types of sites, and flexibly configure them according to business needs.When it is necessary to establish content linkage between different sites, the template tags of AnQiCMS play a crucial role.

Core Mechanism:siteIdParameters

The secret weapon for AnQiCMS to achieve cross-site content invocation lies in the universally supported template tags.siteIdThe parameter. Almost all tags used for content calls, such as getting article lists, category details, single page content, contact information, and even system configuration, include this parameter.

siteIdThe parameter's role is very direct: it tells the template tag which site (identified by the site's ID) to get the data from, rather than fetching data from the current site by default. By simply addingsiteId="X"Among which X is the ID of the target site), we can precisely specify the source of the content.

Practice Case: Cross-site Content Calling

Let's look at several specific examples to seesiteIdHow do the parameters work.

1. Call the article list of a specific site

Assume we have a main site and we want to display the latest product articles of the sub-site "Product Release Center" on its homepage. We can usearchiveListLabel, and specify the "Product Release Center".siteId.

Firstly, we need to know the "Product Release Center".siteIdThis ID is usually found in the 'Multi-site Management' list in the AnQiCMS backend. Assume its ID is2, and the product model ID is2.

{# 假设当前是主站,要调用siteId为2的站点的最新产品文章 #}
<div class="latest-products">
    <h2>产品发布中心最新动态</h2>
    {% archiveList products with moduleId="2" siteId="2" type="list" limit="5" order="id desc" %}
        {% for item in products %}
            <div class="product-item">
                <h3><a href="{{ item.Link }}" target="_blank">{{ item.Title }}</a></h3>
                <p>{{ item.Description|truncatechars:100 }}</p>
                <span>发布日期: {{ stampToDate(item.CreatedTime, "2006-01-02") }}</span>
            </div>
        {% empty %}
            <p>暂无最新产品。</p>
        {% endfor %}
    {% endarchiveList %}
</div>

PasssiteId="2",archiveListTags will retrieve content from the site with ID 2, ensuring that we get the correct source of data.

2. Display classification information from another site

Maybe we would like to list the article categories of another special site in some sidebar of the main station. Similarly, we can usecategoryListTags andsiteIdSuppose a special sitesiteIdresponse for3, the article model ID is1.

{# 调用siteId为3的专题站点的文章分类列表 #}
<div class="topic-categories">
    <h3>专题分类导航</h3>
    <ul>
        {% categoryList categories with moduleId="1" parentId="0" siteId="3" %}
            {% for category in categories %}
                <li><a href="{{ category.Link }}" target="_blank">{{ category.Title }}</a></li>
            {% endfor %}
        {% empty %}
            <li>暂无分类信息。</li>
        {% endfor %}
    </ul>
</div>

Here,siteId="3"Ensure that we see the category structure of the special site, rather than the current site.

3. Obtain the system configuration or contact information of a specific site.

Sometimes, we need to display contact information of other sites on a certain site, or some custom global configuration.systemandcontactLabels are supportedsiteIdAssuming we want to display the contact phone of the child site "Contact Us" on the main site,siteIdresponse for4.

{# 调用siteId为4的站点的联系电话 #}
<div class="contact-info">
    <p>欲了解更多信息,请致电:</p>
    <span>电话:{% contact with name="Cellphone" siteId="4" %}</span>
</div>

PasssiteId="4"we can accurately obtain the phone number of the specified child site.

How to getsiteId

to usesiteIdParameter, first you need to know the ID of the target site.Generally, this information can be viewed in the 'Multi-site Management' module of the AnQiCMS backend.In the site list, each site will have a unique numeric ID for identification.

Attention Points and **Practice

When performing cross-site content calls, there are some details to pay attention to in order to ensure the performance, user experience, and SEO effects of the website.

  • Confirm that the content of the target site has been publishedOnly the content that has been published on the target site can be called and displayed. Drafts or unreviewed content will not be displayed on the front end.
  • Performance considerationsAlthough the Go language foundation and high-performance architecture of AnQiCMS can effectively handle data requests, there may still be some impact on page loading speed when performing a large number of complex cross-site content calls on a single page.Suggest to evaluate the actual needs and reasonably limit the number of calls.
  • SEO impactSite cross-call content if not handled properly, may cause search engines to believe there is duplicate content. To avoid this situation, consider usingrel="canonical"Label points to the original URL of the content, or usenoindex,followmeta tags to guide search engines.
  • Data consistencyEnsure that the content being called is accurate and up-to-date on the source site. Any updates to the source site will be reflected in real-time on the page calling the content.
  • Consistency in template designWhen calling content across sites, consider whether the display style of the target content is consistent with the design style of the current site to avoid a jarring visual experience.

Summary

The multi-site management function of AnQiCMS,配合its flexible template tag system,especiallysiteIdParameters, providing strong support for building complex, highly interconnected websites. By making reasonable use ofsiteIdWe can achieve seamless sharing and display of content between different sites, greatly enhancing the efficiency of content operation and the overall value of the website.Mastering this feature will make it easier for you to manage multi-site content and effortlessly handle various business scenarios.


Common Questions (FAQ)

Q1: How can I know the site I want to call?siteIdWhat is it?A1:siteIdYou can find it on the 'Multi-Site Management' page in the AnQiCMS backend.After logging in, navigate to the 'Multi-site Management' menu, where you will see a list of all created sites. Each site usually has a unique numeric ID to identify it.

Q2: Will cross-site content calls affect website performance?A2: Any data call will incur some performance overhead.AnQiCMS is based on Go language, featuring high-performance characteristics, and usually handles these requests well.If your page makes a large number of complex cross-site content calls, it indeed may affect the page loading speed.Suggest performing performance testing after actual deployment and optimizing the calling strategy based on the results, such as limiting the number of calls, utilizing caching mechanisms, etc.

Q3: Can I call any content from any site? Are there any restrictions?Theoretically, as long as you specify the template tag correctlysiteIdBy providing the correct content type (such as article model ID, category ID, etc.), you can access the public content of any site.The limitation mainly lies in the visibility of the content (for example, unpublished draft content cannot be accessed) and the parameter range supported by the tags themselves.Private or protected content is usually not displayed in this way.