As an experienced website operation expert, I know that how to efficiently and accurately call data while managing multiple content platforms is the key to improving operational efficiency.AnQiCMS, with its excellent multi-site management function, has solved many of these challenges for us.Today, let's delve deeply into the multi-site mode of AnQiCMS,tagListHow to flexibly call the Tag data of a specified site to ensure the accuracy of content operation.
AnQi CMS Overview of Multi-site Capabilities
Let's briefly review the multi-site management capabilities of AnQiCMS.AnQiCMS is designed for small and medium-sized enterprises and content operation teams, one of its core features is its powerful multi-site management function.It allows us to create and independently manage multiple websites under the same system, which is undoubtedly a great convenience for enterprises 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 repetitive work and also facilitates data sharing and resource integration across sites.In the AnQiCMS template tag system, in order to achieve a balance between data isolation and sharing, many tags have introduced a key parameter: siteId.
tagListTag: The Tool for Tag Data Calling
In content operations, 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.AnQiCMS built-intagListTags are used to flexibly call these Tag data in front-end templates.
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 Tag list of the current document, and also list all the tags within the site if no document ID is specifieditemId(Document ID)
Core decryption:siteIdParameter localization
When we deploy AnQiCMS in a multi-site mode, the challenge arises: how to ensuretagListOnly call the Tag of the site I want, not the Tag of the site I am currently visiting, or the Tag of other irrelevant sites? The answer is heretagListTag provided.siteIdIn the parameters.
According to the AnQi CMS documentation,tagListThe Tag is explicitly supportedsiteIdThe parameter exists specifically to address the need for data isolation in a multi-site environment. When you need to retrieve Tag data from a specific site, simply intagListSpecify the site in the tagsiteIdJust do it.
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 block,siteId="1"Tell AnQiCMS to get 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 information between the main site and sub-sites or building cross-site content recommendations.
siteIdWhere does the value come from?
You might ask, thissiteIdWhere can I get the value? In the AnQiCMS multi-site management backend, when we create or manage sites, the system will allocate a unique identification ID for each site.This ID is usually an integer. Administrators can find the details of each site in the "Multi-site Management" list, which includes its internal details.siteId. For operations personnel, understanding and recording thesesiteIdIs the basis for developing accurate templates and content calls.
Practical application scenarios and advanced skills
UnderstoodsiteIdBy using it, we can unlock more practical multi-site content operation scenarios:
The main site aggregates the popular tags of the child site:Assuming you have a brand main site (siteId=1) and two product sub-sites (siteId=2, siteId=3).You hope to display the top 10 tags of sub-product site 2 in some module on 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 %}On the tag detail page, call related articles from other sites:For example, on the Tag detail page of site A, in addition to displaying the articles with this Tag in site A, you also want to display the articles with this Tag in site B.
- Firstly, get the ID of the current Tag(
tagDetailtags). - Then use
tagDataListand specifysiteIdandtagId.
- Firstly, get the ID of the current Tag(
Combine other parameters for more refined filtering:
siteIdThe parameter can be combined with other parameters such aslimit/letter/categoryIdCombine it with, further narrow down the calling scope of Tag. For example, you want to get the latest 5 Tags for the site ID 2, which belong to a specific category ID (like 10).<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 %}
Through such a combination, we can control the display of content in the multi-site environment of AnQiCMS with unprecedented flexibility.
Summary
The multi-site mode of AnQiCMS, combinedtagListlabel'ssiteIdThe parameter provides powerful and flexible tools for content operators and website developers. Whether it is to aggregate content, cross-site recommendations, or implement complex content scheduling,siteIdThey all play a key role in connecting the content of different sites. Mastering this skill can significantly improve the efficiency of website content management and the presentation of content, making your AnQiCMS site group smarter and stronger.
Frequently Asked Questions (FAQ)
Q1: How can I find a specific site in AnQiCMS multi-site mode?siteIdvalue?
A1: siteIdThis is 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 site IDs from the site list in the backend to make precise calls in template tags.If the document does not explicitly show, it is usually obtainable through database queries or system internal API, but in actual operation, an excellent CMS design will ensure that this ID is in the background is