The AnQiCMS (AnQiCMS) is an efficient and flexible content management system, and its powerful multi-site management function is undoubtedly a highlight favored by many operators.When we have multiple brands, regions, or themes of websites, being able to manage them with a single system and flexibly call and display data across different sites will greatly enhance work efficiency and content integration.Then, how can different site data be called and displayed in the multi-site environment of AnQiCMS?

Understanding the core of multi-site data calling: site ID

In the multi-site architecture of AnQiCMS, each independent website is assigned a unique identifier by the system, which we call the "site IDsiteId)。ThissiteIdis the key to cross-site data interaction. When you want to display content from another site on a page template of a site, you need to explicitly tell AnQiCMS the target content ofsiteIdWhat is it.

By default, AnQiCMS template tags are not explicitly specifiedsiteIdParameters are automatically recognized and operated on the current site's data. This allows us to develop templates for individual sites with minimal intervention. However, once it involves cross-site calls, thissiteIdThe parameter becomes the 'bridge' connecting different site data.

Actual Operation: Example of cross-site data call

The template system of AnQiCMS is designed to be very flexible, almost all tags used to retrieve data are built-insiteIdParameters. This makes cross-site data calls direct and easy to understand. Next, we will look at several common application scenarios to seesiteIdhow it works.

Scene one: Display the latest article list of the sub-site on the main site

Assuming we are running a main brand website, we also have a sub-site dedicated to publishing product news.Now, we hope the homepage of the main brand website can display the latest 5 article titles and links of the sub-sites in real time.

If the sub-sitesiteIdYes2, we can write the code in the main site's template like this:

{% archiveList subSiteArchives with siteId="2" type="list" limit="5" order="id desc" %}
    {% for item in subSiteArchives %}
    <li>
        <a href="{{item.Link}}">{{item.Title}}</a>
        <span>发布于: {{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
    </li>
    {% endfor %}
{% endarchiveList %}

This simple code allows the main brand website to dynamically pull and display the latest article list of the sub-sites.When users click on these links, they will be directly redirected to the corresponding article detail page of the child site, realizing seamless connection between sites.

Scene two: Uniformly call the contact methods of different regional sites

Imagine a company with multiple regional branches, each with its own website (subsite), and different contact numbers and addresses.We hope to display the contact information of all branches on a unified 'Contact Us' overview page.

Suppose we know all the branchessiteId[for example]2/3/4) We can iterate through thesesiteIdto dynamically obtain information:

`twig {% set regionalSiteIds = “2,3,4”|split:“,” %} {# This is your list of all regional station IDs #}