How to call the document data of different sites (`siteId`) through the `archiveList` tag?

Calendar 👁️ 61

As an experienced website operations expert, I fully understand the challenges you may encounter when managing content across multiple sites.AnQiCMS (AnQiCMS) provides us with great convenience with its powerful multi-site management capabilities.Today, we will delve into how to make use ofarchiveListLabel and its core parameterssiteIdTo easily implement cross-site document data calls.


Unlock the magic of Anqi CMS multi-site content: how to use it cleverlyarchiveListTag calls for document data from different sites

In the digital age, many companies 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.AnQi CMS is born for this, its unique multi-site management function makes everything orderly.And when we want to display exciting content from another site on a site,archiveListLabel collaborationsiteIdParameters have become our reliable assistants.

AnQi CMS multi-site management: the art of data isolation and intercommunication.

The AnQi 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 undisturbed.However, the wisdom of operation lies in connection and integration. Anqi CMS is well-versed in this, providing a bridge for data intercommunication through a unified template tag system, and cleverly providessiteIdParameters are the key identifiers of this bridge.

In simple terms, when you create and manage multiple sites on the Anqi CMS backend, the system assigns a unique digital ID to each site, which issiteIdThis ID is the 'ID card' for each site, and it is also the reference for cross-site data calls.

Get to knowarchiveListTag: the core tool for content aggregation

archiveListThe tag is a universal tag used in Anqi CMS template engine to retrieve 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, recommended attributes, sorting method, display quantity, etc.).

AndsiteIdThe parameter is exactlyarchiveListTags implement the 'secret weapon' for cross-site data calls. The official documentation clearly states:

siteIdGenerally, it is not necessary to fill in, if you use the multi-site management on the backend to create multiple sites and want to call data from other sites, you can specifysiteIdTo call the data of the specified site.

This means, by default,archiveListThe data will be searched on the site currently running. But as long as we specify it clearlysiteIdit will 'cross over' to the target site, fetching document data from there.

Practice operation: how to usesiteIdPerform cross-site calls

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

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

First, you need to confirm your news sub-site in the multi-site management function of the Anqi CMS background.siteId. 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 template file of the main site (such asindex.htmlWithin 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 namednewsListA variable to store the result. The key issiteId="2"This explicitly tells the tag to get data from the site with ID 2.
  • moduleId="1"Here we assume that the news of the news sub-station is published using the article model (usually 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 the ID of the most recently published document is the largest.
  • limit="5": Only the latest 5 news items are retrieved.
  • 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-site.This way greatly improves the reusability of content, simplifying the management process of cross-site content.

siteIdWidespread application of parameters: not justarchiveList

It is worth mentioning,siteIdThe scope of application of parameters is far beyond.archiveListTags. In the AnQi CMS template design, many other key tags also supportsiteIdTo achieve a more comprehensive cross-site data call. This means that you can retrieve and display from other sites:

  • Category list (categoryList): such as a shared product category tree.
  • Site configuration information (system): Obtain the website name, Logo, etc. of a sub-site.
  • Contact information (contact): Display the contact information of the same company headquarters on different sites.
  • Navigation list (navList): Share common navigation menu.
  • Page details (pageDetail): Call some common "About Us" or "Contact Us" page content.

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

Operational Strategy Proposal

Reasonably utilize in practical operationsiteIdCross-site data calls can help you:

  1. Aggregate contentIntegrate selected content from various sub-sites on the main site to form a content matrix.
  2. Unify brand imageEnsure brand consistency by sharing design elements, contact information, etc.
  3. Optimize SEOEnhance the visibility of site content through internal link structure.
  4. Improve operational efficiencyAvoid creating and managing identical or similar content.

But, also, it is important to pay attention to reasonable planning.siteIdThe calling logic should avoid excessive cross-site requests that may affect performance unnecessarily. For frequently accessed data, consider using caching strategies in conjunction to optimize loading speed.


Frequently Asked Questions (FAQ)

Q1: How do I know my site'ssiteIdare? A1:Generally, you can enter the "Multi-Site Management" feature after logging into the Anqi CMS backend.In the list of sites, each site will display a unique ID.In addition, when you click on a site to edit, the URL in the browser address bar often also containssiteIdParameters (for example/system/site/edit?id=2ofid=2)

Q2: Can I call data fromarchiveListmultiple differentsiteIddocuments in a tag? A2: archiveListlabel'ssiteIdParameters 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 receive in the template.

Q3: Will cross-site data calls affect the loading speed and performance of the website? A3:Any data call will incur some performance overhead. Although cross-site calls are convenient logically, if the call frequency is high, the data volume is large, and it involves multiple sites, it may cause additional load on the database server.

Related articles

How to retrieve related content of the current document using the `archiveList` tag's `type="related"` mode?

As an experienced website operations expert, I am very happy to delve deeply into the `archiveList` tag in AnQiCMS with the `type="related"` mode, which plays a crucial role in content operations and can effectively improve user experience and the website's SEO performance. --- ## In-depth Analysis of AnQiCMS's `archiveList` Tag: How to intelligently retrieve related content and enhance user experience In such an efficient and customizable content management system as AnQiCMS

2025-11-06

How to use the `archiveList` tag to perform keyword search (using `q` parameter) to filter documents on the frontend page?

## Unlock AnQiCMS: Use the `archiveList` tag to implement keyword search and content filtering on the front-end page As an experienced website operations expert, I am well aware of the importance of an efficient and flexible content management system for enterprises.AnQiCMS, this system developed based on the Go language, with its excellent performance and rich features, is becoming the preferred choice for an increasing number of small and medium-sized enterprises and content operation teams.In today's era of information explosion, whether users can quickly find the content they need is directly related to the user experience and conversion rate of the website.

2025-11-06

How to set the display quantity and offset for the `archiveList` tag in AnQiCMS to achieve pagination?

As an experienced website operations expert, I know that an efficient and flexible list display method is crucial for user experience and website performance.AnQiCMS (AnQiCMS) provides us with great convenience with its powerful template tag system.Today, let's delve into how to cleverly set the display quantity and offset using the AnQiCMS `archiveList` tag to achieve a smooth pagination effect.

2025-11-06

How to implement sorting of the document list by views or publication time using the `archiveList` tag?

As an experienced website operations expert, I know that the core value of a content management system (CMS) lies in its flexibility and the efficiency of content presentation.AnQiCMS (AnQiCMS) excels in this aspect with its efficient architecture in the Go language and a rich set of features.Today, let's delve deeply into a function that is extremely commonly used in content operation: how to use the `archiveList` tag to sort the document list by views or publication time.Content sorting seems simple, but it actually contains profound operational strategies.

2025-11-06

How to get the thumbnail, description, and publish time of the document in the `archiveList` loop?

As an experienced website operations expert, I know that how to efficiently and flexibly display content in a content management system is one of the key factors for the success of a website.AnQiCMS (AnQi CMS) relies on its powerful template engine and simple tag design, making content display extremely convenient.Today, let's delve into a very practical scenario: how to elegantly obtain and display the thumbnail, description, and publication time of documents in the `archiveList` loop.

2025-11-06

How to display the Flag attribute of the document in the `archiveList` loop, for example, 'Recommended' or 'Bold'?

As an experienced website operations expert, I am happy to deeply analyze how to flexibly use the `archiveList` loop in AnQiCMS to display the Flag attribute of documents, such as "recommended" or "bold".The core of content operation lies in how to effectively distinguish and highlight key content, and the Flag attribute is a powerful and easy-to-use feature provided by AnQiCMS for this purpose.--- ### Light up your content

2025-11-06

How to combine `archiveList` with `pagination` tag to implement pagination navigation for document list?

As an experienced website operation expert, I am well aware of the importance of an efficient content management system (CMS) for website operation. AnQiCMS, with its high concurrency features in Go language and flexible template mechanism, has provided us with great convenience.Among many features, how to effectively display a large number of documents and provide friendly pagination navigation is crucial for improving user experience and content accessibility.Today, let's delve into how the `archiveList` tag cleverly combines with the `pagination` tag

2025-11-06

How to get the SEO title, keywords, and description of the current document and use it in the page Meta tags?

As an expert well-versed in website operations, I know the importance of SEO titles, keywords, and descriptions (usually referred to as TDK, Title, Description, Keywords) for a website to perform well in search engines.They are the information that users see first on the search results page, directly affecting the click-through rate, and are also a key signal for search engines to understand the content of the page.

2025-11-06