How `tagList` tags display the related Tag list of the specified document?
As an experienced website operation expert, I know that how to flexibly and effectively organize and display content in a content management system is the key to improving user experience and search engine optimization (SEO). AnQiCMS (AnQi CMS) provides many powerful functions in this aspect, and among themtagListLabels are an important bridge connecting content and enhancing discoverability. Today, let's delve deeper into how to use it in AnQiCMStagListTags, accurately display the associated tags list of the specified document.
Fine-grained content management: In AnQiCMStagListHow to efficiently display the associated tags of the specified document?
In the powerful system of AnQiCMS, content tags (Tag) play a role in linking scattered information into a thematic network.They are not just a few keywords, but also an important tool for content aggregation, user interest guidance, and internal link optimization on the website.How to clearly present these 'hidden clues' to visitors after carefully labeling the documents has become the key to enhancing the value of the website.AnQiCMS provided for thistagListLabels, it is like a content curator, which can accurately display the list of tags associated with a specific document according to your instructions.
The value of tags andtagListpositioning
On the AnQiCMS backend, we can add multiple tags to each document, which are somewhat similar to topics and provide a flexible way to associate documents of the same type together, in addition to categories. They help:
- Users discover:Users can quickly find more content related to the same topic by clicking on the tag.
- Content aggregation:The website can form a special page centered around tags, enhancing the depth of content.
- SEO optimization:The tab itself can serve as a page carrying keywords, and the label links within the page build a strong internal link network, which helps search engines understand the structure and content relevance of the website, improving inclusion and ranking.
AndtagListTags, it is exactly the tool that dynamically presents these background management tag data on the website front-end page.It can not only display the current document tags on the document detail page, but also flexibly call other document or site-wide tags as needed.
tagListThe core function and parameter analysis
While usingtagListWhen labeling, we usually wrap it in{% tagList tags with ... %}and{% endtagList %}and use it withforLoop to traverse the returned tag data. It provides a series of practical parameters, allowing you to finely control the acquisition and display of tags:
itemId: Specify the document's 'ID card'This istagListOne of the core parameters of the tag, especially when we want to display the tags associated with a specific document.- Display the tags of the current document:If we use the document detail page (such as article detail, product detail)
tagListAndNot specified explicitlyitemIdIt will intelligently automatically identify and pull the tags associated with the document being viewed. This is the most common and convenient usage. - Display the tags of the specified document:But if we need to displaya specific documentthe tag of (not the current document), for example, a product introduction page shows a related article tag, we can
itemId="文档ID"to specify accurately. For example,{% tagList tags with itemId="123" %}It will display all tags of the document with ID 123. - Display all tags on the site:A special but very practical usage is
itemId="0". When we willitemIdis set to0then,tagListIt is no longer limited to any specific document but will listAll tags created on the entire site.This is very convenient when making tag clouds or tag index pages.
- Display the tags of the current document:If we use the document detail page (such as article detail, product detail)
limitControl the number of displayed items.This parameter is used to limit the number of tags displayed at one time. By default, if not set,tagListup to 10 tags will be displayed. You can adjust this according to the page layout and design requirements,limit="N"Specify the display of N tags, for examplelimit="5"It is also worth mentioning that it supportsoffset,limitpatterns, such aslimit="2,10"This means starting from the second tag, 10 tags are retrieved, which is very useful when fine control over the order and quantity of tag display is needed.categoryId: Filter tags by categorySometimes we may only be concerned with tags under a specific category.categoryIdThe parameter allows us to specify one or more category IDs (separated by English commas, such ascategoryId="1,2,3"Thus, only the tags associated with the documents under these categories are displayed. This helps to provide more focused tag recommendations under the category pages.letterFilter by the first letter:If your tag quantity is large and you need to sort and display them by the first letter,letterthe parameter can be used. You can set it to any letter from A-Z, for exampleletter="A",tagListIt will only return tags that start with 'A' and meet other filtering conditions.siteId: Multi-site compatibilityAnQiCMS has a very powerful multi-site management function. If you have deployed multiple sites and want to call tag data from other sites in the current site, you can usesiteId="站点ID"Specify. This parameter is usually not required in a single-site environment.
tagListThe data returned by the tag is an array object.