English translation: As an experienced website operation expert, I am more than happy to deeply analyze how AnQiCMS can efficiently and flexibly call the single-page detail data of other sites in a multi-site management environment.
English CMS Multi-site Management: Easily Handle Cross-site Single Page Detail Data Calling
In today's rapidly changing digital world, many businesses and content operations teams are facing the challenge of managing multiple websites.Whether it is to distinguish different product lines, service areas, or to expand the multilingual market, multi-site management has become a core requirement.Auto CMS (AutoCMS) was born under such circumstances, and it helps us easily manage multiple content platforms from a single backend with its powerful multi-site management capabilities.
However, multi-site operation is not just about simply creating and managing multiple independent websites.The true value lies in achieving collaboration and data sharing between sites, avoiding redundant construction, and improving overall operational efficiency.Today, let's delve deeply into a very practical feature in a multi-site environment: how to cleverly call the single-page detail data of other CMS sites on the page of your current site.
Core Advantages of English CMS Multi-site Management
Let's quickly review the convenience brought by the multi-site management of the Anqi CMS.It allows you to create and maintain multiple independent website instances in the same system backend.Each site can have its own domain, content, template, and database configuration, but all of these are centralized in one management interface.This centralized management has significantly reduced our daily maintenance workload, and more importantly, it has laid a solid foundation for cross-site data sharing and resource integration.
For example, a group company may own multiple subsidiary brand websites, each with an independent "About Us" page.If the head office website needs to aggregate and display the profiles of all sub-brands, or if a regional site wants to refer to the unified "Privacy Policy" page published by the headquarters, manually copying and pasting is obviously inefficient and prone to errors.This is where the cross-site calling capability of Anqi CMS becomes particularly crucial.
Core Operation: ThroughsiteIdParameter Call Single Page Data of Other Sites
In the template system of AnQi CMS, we have a rich set of tags to retrieve various types of content data. For single-page (Page) details, we mainly usepageDetailLabel. This label is usually used to obtain the single-page content of the current site, but its real strength lies in the fact that it has a built-in siteIdThe parameter, exactly this parameter,打通了cross-site data call.
When you wish to call a single page content of another CMS site at the current site, what you need to do is explicitly tellpageDetailLabel, which site's data do you want. This identifier of 'which site' issiteId.
First step: Determine the target site'ssiteId
When usingsiteIdBefore the parameter, we first need to know the unique identifier ID of the target site.siteIdIt is a number, which is usually found in the "Multi-site Management" feature of your CMS backend.Each successfully created site will have a unique ID assigned to it.Please log in to your main site backend, navigate to the 'Multi-site Management' page, where you will see a list of all configured sites, and easily find the corresponding numeric ID for each site.1,an English brand website may be ID2,another regional site may be ID3and so on.
Step two: ApplypageDetailto call across sites with a label
to obtain the target sitesiteIdAfter that, we can flexibly use the template of the current site.pageDetailTags can be used to call single-page data from other sites.pageDetailTags can also specify the single-page itselfid(i.e., single-page ID) ortoken(URL alias)in addition to,now you can also passsiteIdto specify the data source.
Let's look at a specific code example. Suppose you want to display the ID of2The child brand website, ID is10“About Us” page content:
{# 假设您要调用站点ID为2的子品牌网站中,ID为10的“关于我们”页面数据 #}
{% pageDetail otherSiteAboutUs with id="10" siteId="2" %}
{% if otherSiteAboutUs %}
<div class="card p-4 mb-4">
<h2 class="h4 mb-3">来自子品牌站点的“{{ otherSiteAboutUs.Title }}”</h2>
<div class="content mb-3">
{# 调用并安全输出单页内容,注意使用 |safe 过滤器防止HTML被转义 #}
{{ otherSiteAboutUs.Content|safe }}
</div>
<p class="text-muted small">
了解更多请访问:<a href="{{ otherSiteAboutUs.Link }}" target="_blank" rel="noopener noreferrer">{{ otherSiteAboutUs.Title }}</a>
</p>
</div>
{% else %}
<p class="alert alert-warning">未找到指定子品牌站点的单页数据。</p>
{% endif %}
{% endpageDetail %}
In this code block:
{% pageDetail otherSiteAboutUs with id="10" siteId="2" %}We define a variable namedotherSiteAboutUsvariable to store the single page data obtained.id="10"specified the ID of the target single page, andsiteId="2"It clearly specified that the data should be obtained from the site with ID 2.{% if otherSiteAboutUs %}This is a good programming habit used to check if the data was successfully retrieved to avoid page errors.{{ otherSiteAboutUs.Title }}/{{ otherSiteAboutUs.Content|safe }}/{{ otherSiteAboutUs.Link }}These are commonly used fields for calling single-page detail data. You can access various properties of the single page by using the dot operator..such as title (Title), content (Content), link (Link), description (Description), thumbnails (LogoorThumb)etc.|safe: It is especially important to note that when you call the rich text editor to edit theContentcontent, be sure to use|safeFilter. This tells the template engine that the content is safe HTML code and should be rendered directly without escaping, thus avoiding the display of the original content's HTML tags.
Through this method, you can call the single-page detail data of other sites at any template location on the current site as needed, achieving efficient reuse and aggregation display of content.
Consideration of practical application scenarios
This cross-domain calling mechanism is very practical in many scenarios:
- Unified brand information display:If you have multiple sub-brand websites, the main brand website can call the "brand story" or "contact information" single page of each sub-brand to form a unified corporate overview.
- Global content synchronizationFor enterprises with multilingual sites, the main language site can publish core "Terms of Service" or "Privacy Policy" pages, and then other language sites through
siteIdDirectly call these multilingual single-page applications to ensure content consistency and ease of centralized updates. - Content aggregation portalIn news portals or industry websites, the main site can aggregate and display feature single pages (such as "Industry Overview
超越单页:AnQiCMS的通用跨站调用能力
It is worth mentioning that Anqi CMS'ssiteIdParameters are notpageDetail标签独有。它是一种通用的跨站点调用机制,几乎贯穿于所有获取内容的标签中,例如:
archiveDetailandarchiveList:Used to call the article or product details and list data of other sites.categoryDetailandcategoryList:Used to get the category details and category list of other sites.systemandcontactEven the system configuration information of other sites can be obtained (such as