As a senior website operations expert, I fully understand the challenges you may encounter when managing multi-site content.Auto CMS (AutoCMS) provides us with great convenience with its powerful multi-site management capabilities.archiveListTags and their core parameterssiteId,Easily achieve cross-site document data calls.


Unlock the magic of AnQi CMS multi-site content: How to cleverly usearchiveListTag calls for document data of different sites

In the digital age, many businesses and content operators may have multiple brand websites, sub-sites, or specific content branches, and these sites often need to share or aggregate some content.The AnQi CMS was born for this, its unique multi-site management function makes everything orderly.archiveListlabel combined withsiteIdParameters have become our powerful assistant.

The art of data isolation and intercommunication in multi-site management of Anqi CMS:

The CMS treats each independently operated website as a "site", each of which has its own unique data storage space, including articles, categories, pages, etc.This design ensures data isolation, allowing the operation of each site to be mutually independent.However, the wisdom of operation lies in connection and integration.siteIdParameters are the key identifiers of this bridge.

In simple terms, when you create and manage multiple sites in the Anqi CMS backend, the system will assign a unique digital ID to each site, which issiteIdThis ID is the "identity card" of each site, and also the reference point when we call data across sites.

KnowarchiveListTag: The core tool for content aggregation.

archiveListThe tag is a universal tag used in AnQi CMS template engine to obtain document lists (such as articles, products, news, etc.).It is powerful and can filter and display documents based on various conditions (such as category ID, module ID, recommendation attributes, sorting method, display quantity, etc.).

whilesiteIdParameters are exactlyarchiveListLabel implementation is the 'secret weapon' for cross-site data calls. The official documentation clearly states:

siteIdIt is generally not necessary to fill in, if you use the multi-site management of the background to create multiple sites, and want to call data from other sites, you can do so by specifyingsiteIdto call data from the specified site.

This means, by default,archiveListIt will search for data in the currently running site. But as long as we specify it clearly,siteIdit will "cross" to the target site and retrieve the document data there.

Practice operation: how to usesiteIdPerform cross-site calls

Now, let's look at a specific example to see how to flexibly use it in a templatesiteId.

Suppose you have a main site (siteIdAnd a news sub-site (siteIdThe 2). You want to display the latest 5 news articles of the news sub-site on the homepage of the main site.

Firstly, you need to confirm your news sub-site in the multi-site management feature of the Anqi CMS backendsiteId。usually, this ID can be found in the site list or the URL of the site editing page. For example, if the news sub-sitesiteIdis 2.

next, in the main site's template files (such asindex.htmlor some content block), you can write it like thisarchiveListTags:

{# 在主站点的模板中调用新闻子站(siteId=2)的最新新闻 #}
<div class="latest-news-from-subsite">
    <h2>来自新闻子站的最新报道</h2>
    <ul>
        {% archiveList newsList with siteId="2" moduleId="1" order="id desc" limit="5" %}
            {% for item in newsList %}
                <li>
                    <a href="{{ item.Link }}" target="_blank">
                        <h3>{{ item.Title }}</h3>
                        <p>{{ item.Description|truncatechars:100 }}</p>
                        <time>{{ stampToDate(item.CreatedTime, "2006-01-02") }}</time>
                    </a>
                </li>
            {% empty %}
                <li>当前新闻子站暂无最新内容。</li>
            {% endfor %}
        {% endarchiveList %}
    </ul>
</div>

Code analysis:

  • {% archiveList newsList with siteId="2" ... %}We define a variable namednewsListvariable to store the result. The key issiteId="2", which clearly tells the tag to get data from the site with ID 2.
  • moduleId="1"Here it is assumed that the news of the news sub-site is published using the article model (usually with ID 1). You need to adjust this ID according to the actual situation.
  • order="id desc":Documents are sorted in descending order by document ID, usually with the latest document ID being the largest.
  • limit="5":Only retrieve the latest 5 news items.
  • target="_blank"To improve user experience, when clicking on a link, the news content will open in a new tab.

By making such a simple setting, the main site can dynamically pull and display the content of the news sub-sites.This method greatly enhances the reusability of content and simplifies the management process of cross-site content.

siteIdWidespread application of parameters: not onlyarchiveList

It is worth mentioning that,siteIdThe application scope of parameters is not limited toarchiveListLabel. Many other key labels are supported in the template design of Anqi CMS.siteIdTo achieve more comprehensive cross-site data calls. This means that you can obtain and display data from other sites:

  • Category list (categoryList): For example, a shared product category tree.
  • Site configuration information (system): Get the website name, Logo, etc. of a sub-site.
  • Contact information (contact): Display the same contact information of the headquarters for different sites.
  • Navigation List (navList): Shared general navigation menu.
  • Page Details (pageDetail): Call a general "About Us" or "Contact Us" single page content.

This design philosophy makes the AnQi CMS extremely flexible and powerful in multi-site management, providing endless possibilities for content operators.

Operational strategy suggestions

In actual operation, make reasonable use ofsiteIdPerform cross-site data calls to help you:

  1. Implement content aggregationIntegrate selected content from various sub-sites on the main site to form a content matrix.
  2. Unified brand image:Share design elements, contact information, etc., to ensure brand consistency.
  3. Optimize SEO:Enhance the visibility of each site's content through internal link structure.
  4. Improve operational efficiencyAvoid duplicate creation and management of the same or similar content.

But at the same time, attention also needs to be paid to reasonable planningsiteIdThe call logic, to avoid excessive cross-site requests from affecting performance unnecessarily. For frequently called data, consider using caching strategies in conjunction to optimize loading speed.


Common Questions (FAQ)

Q1: How do I know my site'ssiteIdWhat is it? A1: 通常,You can access the 'Multi-site Management' feature after logging in to the A enterprise CMS backend.In the site list, each site will have a unique ID displayed.siteIdParameters (e.g.,)/system/site/edit?id=2ofid=2).

Q2: Can I call data from multiple differentarchiveListtags at the same time?siteIddocuments? A2: archiveListTagssiteIdParameters can only specify one site ID at a time. If you need to aggregate document data from multiple sites, the usual practice is to use multiplearchiveListtags, each tag specifying onesiteIdThen, they merge or display the data they obtain in the template.

Q3: Will cross-site data calls affect the loading speed and performance of the website? A3:Any data call will incur a certain performance cost. Cross-site calls may be convenient in terms of logic, but if the frequency of calls is high, the amount of data is large, and it involves multiple sites, it may impose additional burdens on the database server.