AnQiCMS Powerful multi-site management feature, bringing great convenience to users who own multiple brands or sub-sites.It not only allows you to manage different content sites uniformly, but also supports data sharing and resource integration across sites.When you want to display content from other sites on a site, or call system configuration information from other sites, AnQiCMS provides a simple and efficient mechanism to achieve this goal.
In AnQiCMS, the core of implementing cross-site content or configuration information calls lies in the flexible use of template tags.siteIdParameter. This parameter acts as a site identifier code, clearly indicating to the system which specific site you want to retrieve data from. By specifying this for various content and configuration-related template tags,siteId,You can easily display the latest articles of the sub-site on your main site, or call the contact information of the corporate website on the product site, etc.
Call content information from other sites
Imagine you have a corporate website and a sub-site dedicated to publishing industry news.If you want to display the latest five news of the sub-site on the homepage of the enterprise official website, you do not need to manually copy and paste, nor do you need complex secondary development.archiveListLabel, and specify the child site.siteIdas follows:
{% archiveList latestNews with type="list" limit="5" siteId="您子站的ID" %}
{% for item in latestNews %}
<li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
{% endfor %}
{% endarchiveList %}
Here,siteId="您子站的ID"It is the key point. It indicates that the system retrieves the article list from the child site you specify.
Similarly, if you need to display the detailed information of a specific article, such as a product introduction page, you can usearchiveDetailTags:
{% archiveDetail productDetail with name="Content" id="指定文章ID" siteId="您产品站的ID" %}
<div class="product-description">{{ productDetail|safe }}</div>
{% endarchiveDetail %}
By specifyingidandsiteId, you can accurately obtain the specific content fields of a specific site.
This mechanism also applies to other types of content tags. For example, if you want to list the category list of a sub-site, you can usecategoryList:
{% categoryList subSiteCategories with moduleId="1" parentId="0" siteId="您子站的ID" %}
{% for category in subSiteCategories %}
<a href="{{ category.Link }}">{{ category.Title }}</a>
{% endfor %}
{% endcategoryList %}
or call the details of a specific single page:
{% pageDetail aboutPage with name="Content" token="about-us" siteId="您子站的ID" %}
<div>{{ aboutPage|safe }}</div>
{% endpageDetail %}
Even can get the tag cloud of other sites or document lists related to a certain tag, just need to intagListortagDataListto addsiteIdparameter.
Call the system configuration information of other sites
systemTags allow you to get various global system configurations:
<img src="{% system with name="SiteLogo" siteId="您官网的ID" %}" alt="Logo">
<p>{% system with name="SiteCopyright" siteId="您官网的ID" %}</p>
Here,siteId="您官网的ID"Let you easily obtain the official website set Logo address and copyright information, without the need to repeat configuration in each sub-site.
If you need to display contact information for another site,contact[en]Tags also support this.siteIdParameters:
<p>联系电话:{% contact with name="Cellphone" siteId="您其他站点的ID" %}</p>
<p>联系邮箱:{% contact with name="Email" siteId="您其他站点的ID" %}</p>
this is especially useful when setting up a unified customer service or information display page.
Even the page's TDK (Title, Keywords, Description) information can betdka tag specificationsiteIdto call:
<title>{% tdk with name="Title" siteId="您其他站点的ID" %}</title>
In addition,navListLabels are supportedsiteIdThis means that you can even display a navigation menu from another site on a single site, achieving a higher degree of unity and reuse.
How to getsiteId
How can you tell the difference between different sites?siteIdEnglish translation: In the AnQiCMS backend management interface, you can view the detailed information of all created sites through the 'Multi-site Management' feature, which usually includes a unique identifier for each site, that is,siteIdThis ID is typically a number, simply replace it in the template tags.siteIdparameter.
This cross-site calling capability provided by AnQiCMS greatly enhances the efficiency and flexibility of multi-site operations. Whether it is content aggregation, unified brand image, or centralized management of core information,siteIdParameters all play an indispensable role, making your multi-site ecosystem more close and efficient.
Common Questions (FAQ)
In which types of template tags can I use
siteId参数?siteId参数几乎支持所有与内容和系统配置相关的 AnQiCMS 模板标签,包括archiveList(文档列表),archiveDetail(文档详情),categoryList(分类列表),pageDetail(Single Page Details),tagList(Tag List),system(System Settings),contact(Contact Information),tdk(Page TDK),navList(Navigation list) 等。Just as long as you need to get data from a non-current site, you usually can try usingsiteIdparameters to specify the source.Will calling data from other sites affect the loading speed of the current site?Since AnQiCMS is a high-performance content management system developed based on the Go language, and is usually deployed on the same server as multiple sites, therefore
siteIdThe internal data call is usually very efficient, with little impact on the loading speed of the current site.If a large amount of data from other sites is called, or the target site itself has a large amount of data and complex queries, it is still recommended that you perform performance testing and consider caching the data to optimize the user experience.If I specify
siteIdDoes not exist, or the content I requested is not available on this site, how will the system handle it?IfsiteId{% if item %}or{% empty %})to handle this situation.