As an experienced website operation expert, I am well aware that how to efficiently and accurately call data when managing multiple content platforms is the key to improving operational efficiency.AnQiCMS (AnQiCMS) has solved many such challenges for us with its excellent multi-site management features.tagListHow to flexibly call the Tag data of a specified site to ensure the accuracy of content operation.
Overview of the multi-site capability of Anqi CMS.
Let's briefly review the multi-site management capabilities of AnQiCMS.AnQiCMS is designed specifically for small and medium-sized enterprises and content operation teams, one of its core highlights being its powerful multi-site management feature.It allows us to create and independently manage multiple websites under the same system, which is undoubtedly a great convenience for businesses with multiple brands, sub-sites, or content branches.Each site is treated as an independent entity in the AnQiCMS backend, with its own content, categories, tags, and even language settings.This design reduces redundant work and also facilitates cross-site data sharing and resource integration.siteId.
tagListTag: A powerful tool for Tag data calling.
In content operation, tags (Tag) play a crucial role.It not only helps users find the content they are interested in quickly, but is also an important part of SEO optimization, effectively improving the relevance and visibility of the content.tagListTags, which are used to flexibly call these Tag data in the front-end template.
tagListThe basic usage of tags is very intuitive. It usually appears in the form of{% tagList 变量名 with 参数 %}, for example:
{% tagList tags with limit="10" %}
{% for item in tags %}
<a href="{{item.Link}}">{{item.Title}}</a>
{% endfor %}
{% endtagList %}
This code will list the latest 10 tags within the site and generate the corresponding links and titles.tagListThe tag itself is very flexible, it can call the current document's Tag list, or list all tags within the site without specifyingitemId(Document ID).
Core Decryption:siteIdAccurate Parameter Location
When we deploy AnQiCMS in multi-site mode, the challenge arises: how to ensuretagListAm I calling the Tag of the site I want, rather than the site I am currently visiting, or the Tag of other irrelevant sites? The answer is righttagListin the tags providedsiteIdin the parameters.
According to the documentation of AnQiCMS,tagListthe tag supports explicitlysiteIdThis parameter exists to address the need for data isolation calls in a multi-site environment. When you need to retrieve Tag data from a specific site, simply intagListLabel the specified site in the tagsiteId.
Here is how to use it:
{% tagList tags with siteId="1" limit="10" %}
{% for item in tags %}
<a href="{{item.Link}}">{{item.Title}}</a>
{% endfor %}
{% endtagList %}
In this code,siteId="1"Tell AnQiCMS to fetch the latest 10 tags from the site with ID 1.This code will consistently display the Tag data of the site with ID 1, regardless of which site the user is currently visiting.This provides great convenience for scenarios such as integrating sub-station information with the main station or building cross-site content recommendations.
siteIdWhere does the value come from?
You might ask, thissiteIdWhere should I get the value?In the multi-site management backend of AnQiCMS, when we create or manage sites, the system will assign a unique identification ID to each site.This ID is usually an integer.siteId. For operations personnel, understanding and recording thesesiteIdIs the foundation for precise template development and content invocation.
Actual application scenarios and advanced techniques
UnderstoodsiteIdBy understanding its usage, we can unlock more practical multi-site content operation scenarios:
Main site aggregation display of sub-site hot Tag:Assume you have a main brand site (siteId=1) and two sub-product sites (siteId=2, siteId=3).You want to display the top 10 tags of the sub-product site 2 in some module of the main station.
<h3>来自产品站2的热门标签</h3> {% tagList product2_tags with siteId="2" limit="10" %} {% if product2_tags %} {% for item in product2_tags %} <a href="{{item.Link}}">{{item.Title}}</a> {% endfor %} {% else %} <p>产品站2暂无热门标签。</p> {% endif %} {% endtagList %}Call related articles from other sites on the Tag detail page:For example, when you are on a Tag detail page of site A, you want to display not only articles with this Tag from site A, but also articles with this Tag from site B.
- Firstly, get the current Tag's ID (
tagDetailTag). - Then use
tagDataListand specifysiteIdandtagId.
- Firstly, get the current Tag's ID (
combined with other parameters for more refined filtering:
siteIdParameters can be combined with other parameters (such aslimit/letter/categoryIdCombine usage to further narrow the scope of Tag calls. For example, you want to get the latest 5 Tags that belong to a specific category ID (such as 10) for site ID 2.<h3>站点2中分类ID为10的最新标签</h3> {% tagList specific_tags with siteId="2" categoryId="10" limit="5" %} {% if specific_tags %} {% for item in specific_tags %} <span><a href="{{item.Link}}">{{item.Title}}</a></span> {% endfor %} {% else %} <p>站点2中分类ID为10的标签暂无数据。</p> {% endif %} {% endtagList %}
By such a combination, we can achieve unprecedented flexibility to precisely control the display of content in the multi-site environment of AnQiCMS.
Summary
AnQiCMS multi-site mode, combined withtagListTagssiteIdParameters, providing powerful and flexible tools for content operators and website developers. Whether it is aggregating content, cross-site recommendations, or implementing complex content scheduling,siteIdAll play a crucial role in connecting content across different sites.Mastering this skill can significantly improve the efficiency and presentation effect of website content management, making your AnQiCMS site cluster more intelligent and powerful.
Common Questions (FAQ)
Q1: How can I find a specific site in AnQiCMS multi-site mode?siteIdvalue?
A1: siteIdIt is usually a unique integer identifier assigned to each site in the 'Multi-site Management' feature of the AnQiCMS backend.When you add a new site, the system will record and use this ID.As an administrator, you can view or obtain the IDs of these sites in the site list on the backend to make precise calls in template tags.