As an experienced website operations 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) offers many powerful features in this aspect, and among themtagListThe label is an important bridge that connects content and enhances discoverability. Today, let's delve into how to use AnQiCMStagListLabel, accurately displays the associated tag list of the specified document.

Fine-grained content management: In AnQiCMS,tagListHow 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 important tools for content aggregation, user interest guidance, and internal link optimization of the website.How to clearly present these 'hidden clues' to visitors after carefully labeling documents, becomes the key to enhancing website value.tagListTags, it acts like a content curator, able to accurately display the list of tags associated with a specific document according to your instructions.

The value of tags andtagListpositioning

In AnQiCMS backend, we can add multiple tags to each document. These tags are somewhat similar to topics and provide a flexible way to associate documents of the same category together, in addition to classification. They are helpful for:

  • User found:Users can quickly find more content related to the same topic by clicking on the tags.
  • Content Aggregation:The website can create special topic pages centered around tags, enhancing the depth of content.
  • [en] SEO Optimization:The tab itself can act as a page carrying keywords, and the tag links within the page build a powerful internal link network, which helps search engines understand the structure and content relevance of the website, improving inclusion and ranking.

whiletagListTags, which are the tools that dynamically present these background management tags data on the website frontend page, are labels.It can not only display the tags of the current document on the document detail page, but also flexibly call other document tags or the tags of the entire site as needed.

tagListThe core function and parameter interpretation of English

When usingtagListwhen labeling, we usually wrap it in English{% tagList tags with ... %}and{% endtagList %}English and coordinate withforLoop to traverse the returned label data. It provides a series of practical parameters that allow you to finely control the acquisition and display of labels:

  1. itemId: Specify the "ID card" of the documentThis istagListThe core parameter of the label, especially when we want to display the tags associated with a specific document.

    • Display the tags of the current document:If we use it on the document detail page (such as article detail, product detail)tagListwhileNot explicitly specifieditemIdIt will intelligently automatically recognize and pull the tags associated with the document being viewed. This is the most common and convenient usage.
    • Show the tags of the specified document:But if we need to displaySome specific document(Instead of the current document) tags, for example, a related article tag displayed on a product introduction page, we can specify it exactly throughitemId="文档ID". 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 isitemId="0".itemIdset0whentagListThis is no longer limited to any specific document, instead it will listAll tags created on the entire site. This is especially convenient when making tag clouds or tag index pages.
  2. limit: Control the display quantity.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 the number according to the page layout and design requirements,limit="N"Specify N tags to display, for examplelimit="5"It is worth mentioning that it also supportsoffset,limitmode, for examplelimit="2,10"This means to start from the 2nd label and get 10 labels, which is very useful when needing more precise control over the order and number of label display.

  3. categoryId: Filter labels by categorySometimes we may only care about the 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"This shows only the tags associated with the documents under these categories. It helps to provide more focused tag recommendations on the category page.

  4. letter: Filter by the first letter.If you have a large number of tags and need to sort and display them by the first letter,letterthe parameter can be very useful. You can set it to any letter from A to Z, for example,letter="A",tagListThe tags returned will only be those that start with 'A' and meet other filtering conditions.

  5. siteId:Multi-site compatibilityThe multi-site management function of AnQiCMS is very powerful. If you have deployed multiple sites and want to call tag data from other sites in the current site, you can usesiteId="站点ID"Specify it. In a single-site environment, this parameter is usually not set.

tagListThe data returned by the tag is an array object.