How to implement cross-site calls for the `siteId` parameter of the `archiveParams` tag in the AnQiCMS multi-site environment?

Calendar 👁️ 56

Govern the Anqi CMS multi-site:archiveParamsin the tagsiteIdCross-site parameter call practice

As an experienced website operations expert, I am well aware that efficient content management and flexible content scheduling are the key to business success in an increasingly complex network environment.AnQiCMS (AnQiCMS) provides powerful tools for operators with its excellent multi-site management capabilities.Today, let's delve into a very practical feature in a multi-site environment:archiveParamsHow to pass through the tagsiteIdImplement cross-site content call via parameters.

Insight into the charm of Anqi CMS multi-site management

The Anqi CMS has always fully considered the needs of multi-site management, allowing enterprises and operation teams to easily build and unify the management of multiple websites.This not only greatly reduces the repetitive workload, but more importantly, it provides a solid foundation for cross-site data sharing and resource integration.Imagine that your brand has multiple sub-sites, each possibly focusing on different product lines or service areas, but they need to share some common content or data - such as detailed parameters of a core product, or an important company announcement.At this moment, a simple and efficient cross-site content call mechanism is particularly important.

archiveParamsThe label: The core tool for accurately obtaining document parameters

In the template system of Anqi CMS,archiveParamsIt is a powerful tag, whose main responsibility is to obtain various parameters of the specified document.These parameters may include custom fields defined in the document model, such as product model, author, source, and so on.In most cases, we use it in the current site environment, for example:

{# 假设我们正在文档详情页,获取当前文档的所有参数 #}
{% archiveParams params %}
    {% for item in params %}
    <div>
        <span>{{ item.Name }}:</span>
        <span>{{ item.Value }}</span>
    </div>
    {% endfor %}
{% endarchiveParams %}

This code will be repeatedly displayed in the context of the current document, showing all the names and values of its custom parameters. However, when our gaze turns to the multi-site environment, ...archiveParamsThe true potential will be fully released.

siteIdParameter: The key to building a cross-site data bridge.

In the AnQi CMS multi-site architecture, each independent site has a unique identifier, namelysiteId. ThissiteIdIt is like the 'ID number' for each site. When you need to display specific document parameters of another site (like site B) within the current site (like site A),siteIdThe parameter becomes the bridge connecting these two sites.

The AnQi CMS documentation explicitly 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 implement calling data from a specified site.

This means, you no longer need to copy content, nor do you need complex API integration, just add inarchiveParamsa simple tagsiteIdParameters can easily retrieve the parameter information of the required documents from specified other sites. This ability greatly enhances the flexibility and efficiency of content operation.

Practice exercise: Cross-site callarchiveParams

In order to understand bettersiteIdApplication, let's simulate a common scenario: Your main brand website (site A, assuming itssiteIdWith1)Need to display the website of its subsidiary brand (site B, assuming itssiteIdWith2)specific parameters of a product. Suppose site B has a product document with the ID of101We hope to obtain the product's "model" and "color" parameters at site A.

Firstly, you need to confirm the site B's in the "Multi-site Management" feature of the Anqi CMS backend.siteId. This ID is usually displayed in the site list or site configuration details.

Next, in the template file of site A, you can use it like this.archiveParamsTags:

<h3>子品牌产品详情</h3>
{% archiveParams productDetails with id="101" siteId="2" %}
    {% if productDetails %}
        <p>产品型号:{{ productDetails.型号.Value }}</p>
        <p>产品颜色:{{ productDetails.颜色.Value }}</p>
        {# 也可以遍历所有参数,如果“型号”和“颜色”是自定义字段 #}
        <h4>所有参数:</h4>
        <ul>
            {% for param in productDetails %}
                <li>{{ param.Name }}:{{ param.Value }}</li>
            {% endfor %}
        </ul>
    {% else %}
        <p>未能找到站点B中ID为101的产品参数。</p>
    {% endif %}
{% endarchiveParams %}

In this code block:

  • id="101": Specifically specified the document ID to be retrieved.
  • siteId="2": This is crucial! It tells Anqi CMS to go to the ID of2and find the parameters of this document in the site database.
  • productDetails.型号.ValueIf "model" is a custom field andsorted=false(i.e., when getting an unordered map object), you can access it directly. Ifsorted=true(To obtain an array of objects sorted in a fixed order, you need to pass it through the example as shown)forlooped through.

By making such a call, site A can dynamically display the related parameters of the products in site B, without manually copying and pasting. Once the product parameters in site B are updated, site A will also synchronize the display of the latest data, ensuring consistency and timeliness of the content.

siteIdThe wide application: not justarchiveParams

It is worth mentioning,siteIdThe parameter is notarchiveParamsThe tag is unique. In the template design of Anqi CMS, in order to achieve flexible data calling in a multi-site environment, many core data acquisition tags are supportedsiteIdParameters. This includes but is not limited to:

  • archiveList: Retrieve the document list of the specified site.
  • archiveDetail: Retrieve the document details of the specified site.
  • categoryList: Retrieve the category list of the specified site.
  • **`categoryDetail

Related articles

How to call the `archiveParams` tag individually in AnQiCMS template to get custom document parameters with a specific name?

In the rich feature treasure trove of AnQiCMS, the content model and custom document parameters are undoubtedly the foundation of its flexibility and powerful extensibility.As an expert in website operations, I am well aware of how to efficiently and accurately call these custom parameters in templates, which is crucial for achieving personalized content display and optimizing operational efficiency.Today, let's delve deeply into a powerful and often overlooked technique in the AnQiCMS template: how to call the `archiveParams` tag individually to obtain custom document parameters with a specific name.Introduction

2025-11-06

How to use the `archiveParams` tag to dynamically display the product specification parameter list on the product detail page?

In the era where content is king, an efficient and flexible content management system is crucial for a company's online operations.AnQiCMS (AnQiCMS) is an advanced enterprise-level content management system developed based on the Go programming language, with its powerful content model and template tag system, providing us with infinite possibilities for refined content operation.Today, let's delve into a very practical scenario: how to cleverly use the AnQiCMS `archiveParams` tag to dynamically display a rich variety of product specification parameter lists on the product detail page

2025-11-06

How to loop through and display the `Name` and `Value` of custom parameters using the `archiveParams` tag in AnQiCMS templates?

In the flexible world of AnQiCMS, the custom parameters (Content Model) provide website operators with great freedom, allowing us to break through the limitations of traditional titles, content, and summaries, and add personalized data fields for different types of documents (such as articles, products, cases, etc.). For example, a product detail page may need to display information such as 'product model', 'color options', 'material', etc., while a technical article may require fields such as 'author', 'publication date', 'references', etc.

2025-11-06

In the `archiveParams` tag, what scenarios are `sorted=true` and `sorted=false` applicable to?

As an experienced website operation expert, I know that how to flexibly use template tags to display content in such an efficient content management system as AnQiCMS is the key to operation success.Today, let's delve into how the `archiveParams` tag's `sorted=true` and `sorted=false` parameters can have an effect in specific scenarios.Anqi CMS, with its concise and efficient architecture, provides great convenience for content creators and operators.

2025-11-06

The `archiveParams` tag returns custom parameters, is the data structure a fixed array or a variable Map?

Hello, all website operators and AnQi CMS enthusiasts! Today, we will delve into a practical and flexible tag in the Anqi CMS template development——`archiveParams`.Many times, when using custom parameters, there is a question: What is the data structure of the custom parameters returned by the `archiveParams` tag, whether it is a fixed array or a variable Map?In order to better utilize the strong content model customization capabilities of Anqi CMS, it is crucial to understand this point.This article will explain in detail

2025-11-06

How to judge whether a custom parameter exists and display in AnQiCMS via the `archiveParams` tag?

In the powerful content management system of AnQi CMS, custom parameters (also known as content model custom fields) are an important manifestation of its flexibility.It allows operators to add personalized data to content models such as articles, products, etc. according to specific business needs.But in the front-end template, we often need to determine whether a custom parameter exists or has been assigned a valid value before deciding whether to display it.This is when the `archiveParams` tag becomes an indispensable tool.##

2025-11-06

How to safely render `archiveParams` tag if the document parameters contain HTML content?

AnQiCMS (AnQiCMS) is a powerful content management system developed based on the Go language, with flexible content models and customizable document parameter functions, providing great freedom for enterprises and content operators.This means we can create unique fields for articles, products, and other content to meet personalized display needs.

2025-11-06

How to filter the items to display in the `archiveParams` loop based on the custom parameter name?

As an experienced website operations expert, I know that the flexibility of the Content Management System (CMS) is the key to the website's ability to quickly respond to market changes and optimize content structure.AnQiCMS (AnQiCMS) with its powerful custom content model feature, provides us with great convenience.However, defining custom parameters is not enough. How to flexibly call and filter these parameters according to actual needs is a practical problem faced by many operators and developers.

2025-11-06