How to call and display data from different sites in AnQiCMS multi-site management?

Calendar 👁️ 68

AnQiCMS (AnQiCMS) is an efficient and flexible content management system, and its powerful multi-site management function is undoubtedly a highlight that many operators are keen on.When we have multiple brands, multiple regions, or multiple thematic websites, we can manage them uniformly through a single system, and flexibly call and display data between different sites, which will greatly enhance work efficiency and content integration.How can we implement the calling and display of data between different sites in the AnQiCMS multi-site environment?

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

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

By default, AnQiCMS template tags are not explicitly specified.siteIdWhen a parameter is passed, it will automatically identify and operate on the data of the current site. This makes it unnecessary for us to intervene much when developing templates for a single site. However, once it involves cross-site calls, thissiteIdParameters become the bridge to connect data between different sites.

Actual operation: Example of cross-site data call

The AnQiCMS template system 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 in detail.siteIdHow it works.

Scenario one: Display the latest article list of the child site on the main site

Assuming we are operating a main brand website, we also have a dedicated sub-site for product news.Now, we hope that 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 child site'ssiteIdIs2, we can write the code in the template of the main site 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 %}

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

Scenario two: Call the contact information of different regional sites uniformly

Imagine a company with multiple regional branches, each with its own independent 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.

Assuming we know all the branchessiteIdfor example2/3/4),we can loop through thesesiteIdto dynamically obtain information:

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

Related articles

How to display the unique field content according to a custom content model?

AnQi CMS with its powerful content management capabilities, especially the flexible content model, makes the organization of our website content simpler than ever before.When the standard content field cannot meet specific business needs, a custom content model and its unique fields emerge.How can you accurately call and display these unique custom field contents in the website front-end template?This article will detail the mysteries revealed for you. ### 1. Understanding the content model and custom fields of AnQi CMS One of the core strengths of AnQi CMS is its highly flexible content model

2025-11-07

How to generate and display breadcrumb navigation in the AnQiCMS template?

In website operation, a clear navigation structure is crucial for improving user experience and search engine optimization (SEO).Imagine if, when visitors delve deep into your website, there was a path guide to tell them 'You are here', wouldn't that make them feel at ease and convenient?This is the function of Breadcrumb Navigation.It is like breadcrumbs scattered in fairy tales, helping users easily backtrack in the website and understand the position of the current page in the overall website structure.

2025-11-07

How to display the friend link list on the AnQiCMS website?

Friend links are an indispensable part of website operation, as they not only promote communication and cooperation between websites, but also have a positive effect on SEO optimization.In AnQiCMS, displaying the friend link list is a simple and efficient process, allowing website administrators to easily provide visitors with more valuable external resources. ### Backend Management: Configure Your友情链接 Firstly, you need to configure the友情链接 in the backend of AnQiCMS in order to display it on the front page.

2025-11-07

How to display single page content in AnQiCMS, such as the "About Us" or "Contact Us" page?

Displaying single-page content such as 'About Us' or 'Contact Us' in AnQiCMS is a very intuitive and flexible process.The system is designed to meet the needs of such static information display, through simple backend management and powerful template rendering capabilities, allowing you to easily create and beautify these important web pages. ### Create and Manage Single Page in the Back-end Firstly, all the content of single pages needs to be created and managed in the AnQiCMS back-end.

2025-11-07

How to loop through and display the article tag list in AnQiCMS templates?

In Anqi CMS, article tags are not only a tool for organizing content and improving user experience, but also an important element for optimizing search engine crawling and ranking (SEO).They can help visitors quickly find relevant content and can also help search engines better understand the website structure.How can I flexibly loop through and display these article tag lists in the AnQiCMS template?This is actually simpler than you imagine, the powerful template tag system of AnQiCMS makes everything very intuitive.

2025-11-07

How to implement multi-language content switching and display on AnQiCMS websites?

Under the wave of globalization, website multilingual support has become a necessary condition for enterprises to expand into the international market.AnQiCMS as an enterprise-level content management system, fully considers this requirement and provides a set of efficient and flexible solutions to help users easily switch and display multilingual content. ### AnQiCMS implementation logic for multilingual The core strategy of AnQiCMS for switching and displaying multilingual content is based on its powerful "multi-site management" function.

2025-11-07

How to implement pagination functionality and customize the number of page numbers displayed in AnQiCMS templates?

In a content management system, an effective pagination feature is crucial for improving user experience and the SEO performance of the website.When the amount of content on a website gradually increases, organizing and displaying the content list reasonably allows visitors to browse information more easily and helps search engines better crawl and index the page.AnQiCMS as an efficient content management system provides flexible and easy-to-use template tags, allowing you to easily implement pagination in the template and customize the display of page numbers as needed.To implement pagination in the AnQiCMS template, it mainly involves two core steps

2025-11-07

How does AnQiCMS ensure that uploaded images are automatically converted to WebP format to optimize loading speed?

In today's fast-paced digital world, website loading speed directly affects user experience and search engine rankings.Especially images, they are often the main culprits in slowing down website speed.Large image files not only consume more server bandwidth, but also extend the page rendering time, leading to visitor loss. 幸运的是,AnQiCMS understands this and provides us with an elegant solution through intelligent image processing: automatically converting uploaded images to WebP format to optimize website loading speed. WebP is a modern image format developed by Google

2025-11-07