As an experienced security CMS website operation personnel, I know the core position of content in website operation.How to efficiently and flexibly call and manage content in a multi-site environment, especially single-page data, is a real challenge faced by many operators.The Anqi CMS, with its powerful multi-site management capabilities, provides us with an elegant solution.

Content sharing strategy in the Anqi CMS multi-site environment

The AnQi CMS was designed from the beginning to consider the needs of enterprises and content operation teams for multi-site management.It allows us to create and independently manage multiple sites under the same system, with each site having its own domain, template, content model, and data.The advantage of this architecture lies in the fact that it not only reduces the workload of repetitive deployment and maintenance, but more importantly, it provides convenience for cross-site content sharing and integration.

siteIdParameters, have broken through the barriers between different sites' content calls, allowing one site to easily call the single-page data of another site.

UtilizesiteIdParameters implement cross-site single-page data calls

The template tag system of Anqi CMS is very flexible, one of the core highlights is that it supportssiteIdThe parameter allows us to explicitly specify from which site to retrieve data. For single-page data,pageDetailtags are our main tools, andpageListTags can help us obtain the single-page list of other sites.

Call the single-page data of other sites.

To call the specific single-page data of other sites, we can use.pageDetailLabel, and throughsiteId/id(Single page ID) ortokencombination to precisely specify the target.

Suppose our main site (site ID 1) has a 'Contact Us' single-page, its ID is 10, and the URL alias iscontact-us.Now, we hope to display the title and some content of the 'Contact Us' page of the main site on some page of the child site (site ID 2).

First, to get the title of the single page, you can write the following code:

{# 调用主站(siteId=1)ID为10的单页面标题 #}
<div>主站的联系方式标题:{% pageDetail with name="Title" id="10" siteId="1" %}</div>

{# 如果知道URL别名,也可以这样调用 #}
<div>主站的联系方式标题:{% pageDetail with name="Title" token="contact-us" siteId="1" %}</div>

If we want to get the complete content of the single page and display it, we can do it like this:

{# 获取主站ID为10的单页面内容 #}
{% pageDetail mainSiteContactContent with name="Content" id="10" siteId="1" %}
<div class="main-site-contact-info">
    <h2>{% pageDetail with name="Title" id="10" siteId="1" %}</h2>
    {{ mainSiteContactContent|safe }}
</div>

In this way, we can flexibly refer to the single-page information of the main site or other specified sites in any template of the child site, such as introduction text, pictures, contact information, etc.This has a very practical significance for maintaining brand information consistency and reducing content maintenance costs.

Call the single page list of other sites

In addition to calling a single single-page, sometimes we may need to retrieve a set of single pages from other sites, such as a FAQ list or a series of partner pages. At this time,pageListThe label comes in handy. Similarly,siteIdThe parameter is the key to implementing cross-site list calls.

Assuming the main site (site ID 1) has a series of single pages with IDs 20, 21, 22, we want to display the titles and links of these pages on the sub-site (site ID 2).

{# 调用主站(siteId=1)的所有单页面列表 #}
<div class="main-site-pages-list">
    <h3>来自主站的相关页面</h3>
    <ul>
    {% pageList mainSitePages with siteId="1" %}
        {% for item in mainSitePages %}
            {# 排除某些特定页面,例如ID为10的“联系我们”页面 #}
            {% if item.Id != 10 %}
            <li><a href="{{ item.Link }}" target="_blank">{{ item.Title }}</a></li>
            {% endif %}
        {% endfor %}
    {% endpageList %}
    </ul>
</div>

This code segment will fetch all single pages from the main site and display their titles and links on the sub-site, and we can also filter according to requirements (for example, excluding the "Contact Us" page with ID 10).

Operational practices and **strategies

In usingsiteIdWhen parameters are used for cross-site content calls, some operational practices and **strategies are worth our attention:

  1. Plan site ID and content structure:At the early stage of deployment across multiple sites, it should be planned well for each site'ssiteIdCategorize and manage content across different sites. For example, determine which single pages are common content (shareable) and which are site-specific content.
  2. Avoid unnecessary repetition: Cross-site calls are used to reduce redundant labor. If a single page is needed on multiple sites and its content is basically consistent, then put it on a main site and access it throughsiteIdCall is**select.
  3. Pay attention to performance optimization:Although AnQiCMS is developed based on Go language and has excellent performance, but making a large number of cross-site data calls on a single page may still have a slight impact on page loading speed.When designing, one should weigh the needs of content sharing with page performance, and avoid over-reliance on real-time cross-domain calls.Consider appropriate caching on the server for important content that does not change frequently.
  4. SEO and standard links:If cross-site called content is duplicated and you want search engines to correctly identify the original source of the content, it is necessary to set it on the source site of the called content.CanonicalUrl(Standard link), and ensure that the standard link is correctly referenced on the calling site, pointing to the original content address.This helps to avoid the misjudgment of duplicate content by search engines, protecting the SEO weight of the original site.
  5. Permissions and security: siteIdParameters provide data calling capabilities at the template level, which means that as long as you have the authority to modify the template, you can call data from other sites. In team collaboration, it is necessary to ensure that template developers and content operators are aware ofsiteIdThe use has a clear understanding and operational specification, avoiding误operation or information leakage.

By deeply understanding and skillfully applying the AnQiCMS providedsiteIdParameters, we can achieve high reusability and flexible management of content in a multi-site operation environment, greatly enhance the efficiency of content operation, and provide users with a more unified and high-quality browsing experience.


Frequently Asked Questions (FAQ)

1. Can I call data from a site that is completely independent of the current AnQiCMS instance and deployed on another server?

No. AnQiCMS'ssiteIdParameters are for multiple sites created and managed under the same AnQiCMS core program via the background "Multiple Site Management" feature. Although these sites are logically independent, they share the same database and file system (in Docker deployment mode, it may refer to Docker volumes or shared directories), so the program knows how to according tositeIdSwitch context to read data. It cannot be used to call external website data unrelated to the current AnQiCMS instance.

2. Will calling single-page data from other sites affect the URL structure or SEO performance of my current site?

If it is just to call the title, content snippet, etc. of other sites and embed it into the current page, it usually will not directly affect the URL structure of the current page point. However, if the called content is semantically repetitive and you want the search engine to correctly identify the original content source to avoid SEO problems, then it is necessary to set it up at the source site of the called contentCanonicalUrl(Reference link), and ensure that the reference link is correctly cited on the current page and points to the original content. For example, if the "About Us" page of the main site is referenced by the sub-site, the "About Us" page of the main site should have<link rel="canonical" href="主站关于我们页面的完整URL" />.

3. Besides single-page data, I can also usesiteIdWhat types of data can I call from other sites using parameters?

In AnQiCMS, many of the main template tags are supportedsiteIdParameters to enable cross-site data calls. In addition,pageDetailandpageListYou can also usesiteIdparameters to call the category list of other sites (categoryList), category details (categoryDetail), document list (archiveList) Document Details (archiveDetail) System Configuration Information (system) Contact Information (contact) Navigation Menu (navList) etc. This greatly expands the possibility of cross-site content sharing and integration, making multi-site content management more flexible.