How to call single page data from other sites in a multi-site environment?

Calendar 👁️ 59

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.

In the operation, we often encounter such a situation: the main site may have a "About Us" page, and the sub-sites or related brand sites also need to display similar information, or need to refer to a specific partner introduction page on the main site.Manually creating and maintaining this single-page content at each site is inefficient and prone to errors.AnQi CMS through its uniquesiteIdParameters, 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.

Related articles

Can the creation time or update time of a single page be retrieved and displayed?

In the operation practice of Anqi CMS, we often pay attention to the time information of the release and update of website content.This is crucial for search engine optimization (SEO) and for users to understand the timeliness of content.Whether the creation time or update time of a single page (Page) can be obtained and displayed, a detailed analysis based on the document provided by Anqi CMS can lead to a clear conclusion.The 'Page Management' feature of AnQi CMS is mainly used to create and manage independent static content pages, such as 'About Us', 'Contact Information', etc.

2025-11-06

How to correctly call the `Link` single page link in the template?

As an experienced security CMS website operator, I know that correctly calling content links in templates is crucial for website user experience and search engine optimization.The single page is a key part that carries static information such as 'About Us' and 'Contact Information', and the accurate calling of its links is an indispensable part of daily operation. I will elaborate in detail on how to correctly call single-page links in the Anqi CMS template.### Understanding Single Page Links in AnQi CMS In AnQi CMS, a single page (also known as a "page") exists independently of content models such as articles, products, and the like.

2025-11-06

How to obtain the SEO title and description of a single page through template tags?

As an experienced security CMS website operator, I am well aware of the key role that each page plays in search engine optimization, especially the SEO title and description.They are not only the first line of defense to attract users to click, but also an important signal to convey the core content of the page to search engines.AnQi CMS is well-versed in this, providing us with powerful and flexible template tags, allowing us to precisely control the SEO elements of each single page.

2025-11-06

How to use the lazy loading feature of images in single page content?

As an experienced AnQiCMS website operator, I know the importance of website performance for user experience and SEO.Lazy loading of images is an essential optimization method to improve website loading speed, especially on single-page content that contains a large number of images.AnQiCMS provides good support for lazy loading of images at the content rendering level, allowing us to implement this feature through simple template configuration combined with front-end technology. I will elaborate in detail on how to implement lazy loading of images in the single-page content of AnQiCMS.

2025-11-06

How to configure a canonical URL for a single page to optimize SEO?

As a website operator who has been deeply involved in AnQiCMS for many years, I am well aware of the profound impact that every detail has on SEO optimization in content creation and publication.The canonical URL is one of the often overlooked elements that are crucial for search engine rankings and website health.It can effectively solve the problem of duplicate content, concentrate the page weight, and is an effective tool to improve SEO performance.I will elaborate in detail on how to configure standard links for single pages in AnQiCMS

2025-11-06

How to set up pseudo-static rules for a single-page to optimize URL structure?

As an operator who deeply understands the operation of AnQiCMS, I know that a clear and semantical URL structure is crucial for the website's search engine optimization (SEO) and user experience.Strong static function provided by Anqi CMS, allowing website administrators to flexibly define the URL form of the website.Today, we will delve into how to set up pseudo-static rules for a single-page application to build more attractive and readable URLs.

2025-11-06

What impact does customizing the static rule have on the single page URL?

As an experienced website operator familiar with the characteristics of AnQiCMS, I am well aware of the importance of URL structure to the performance of the website.The custom static rules feature is a powerful function provided by AnQiCMS, which allows us to flexibly define the URL form of website content.For a single-page website, the application of this feature is particularly direct and has a profound impact.**AnQiCMS Base URL and Custom Settings** In AnQiCMS, a single page usually carries independent and static content such as "About Us", "Contact Us", "Privacy Policy", etc.

2025-11-06

How to ensure the security and compliance of content on a single page, for example, sensitive word filtering?

As an experienced security CMS website operator, I am well aware of the importance of content security and compliance for the healthy development of the website, especially in terms of single-page content.A single page usually carries the brand image, core business introduction, or important announcements, and the accuracy, legality, and positivity of its content are crucial.AnQi CMS provides a multi-level security mechanism to help operators effectively manage content risks.Ensure the importance of content security compliance on single-page websites in the current internet environment, content security has become the cornerstone of website operation.For the single page on AnQi CMS

2025-11-06