As an AnQiCMS website operator deeply involved in content operation, I fully understand the importance of tags in content organization and user experience.Tags can not only help readers quickly find the content they are interested in, but also are key elements for optimizing website structure and improving SEO performance.Today, we will discuss in detail how to obtain and display the detailed information of a specified Tag label in AnQiCMS, including its name and description.

AnQiCMS Tag Management Overview

In AnQiCMS backend, the tag management feature allows us to create and maintain various tags for documents.These tags are independent of the classification and content model, and can be flexibly associated with documents of different types.Each tag has a unique name, optional description, index letter, custom URL, and SEO-related TDK (title, keywords, description) information.The background management interface is clear and intuitive, allowing for convenient addition, editing, and deletion operations, ensuring the accuracy and integrity of tag data.Through these rich configurations, we can build an informative and SEO-friendly page for each tag.

Display label details in the template

To display specific Tag tag details on the front-end page, AnQiCMS provides powerful template tagstagDetailThis tag is designed to retrieve complete data for a single tag, whether it is a tag on the current page, or a tag specified by ID or URL alias, it can be easily retrieved.

UsetagDetailThe basic syntax for retrieving label information is:{% tagDetail 变量名称 with name="字段名称" [id="标签ID" | token="标签URL别名"] %}.变量名称It is optional. If set, the subsequent data retrieved can be called through this variable;nameThe parameter is used to specify the label field to be retrieved;idortokenThe parameter is used to explicitly specify which tag's details to retrieve. If the current page is already a detail page of a tag (for example, it is usuallytag/list.htmlortag/index.htmla page),idandtokenThe parameter can be omitted, the system will automatically recognize the current tag.

Get the tag name (Title)

The name of the tag can be accessed throughname="Title"Parameter acquisition. This name is usually set in the background for the label, used for the display text in the user interface.

{# 直接输出当前页面的标签名称 #}
<div>标签名称:{% tagDetail with name="Title" %}</div>

{# 将标签名称赋值给变量再输出 #}
{% tagDetail tagName with name="Title" %}
<div>当前标签的名称是:{{ tagName }}</div>

{# 获取指定ID的标签名称 #}
<div>标签ID为5的名称:{% tagDetail with name="Title" id="5" %}</div>

Get label description (Description)

The description information of the label can be obtainedname="Description"through parameters. This is a brief overview of the label content, which is very important for SEO and for users to understand the meaning of the label.

`twig {# Directly output the tag description of the current page #}

Label description: {% tagDetail with name=“Description” %}

{# 将标签描述赋值给变量再输出 #} {% tagDetail tagDesc with name=“English” %}

The description of the current tag is: {{ tagDesc }}

{# Get the description of the tag with a specified ID #}

标签ID为5的描述:{% tagDetail with name=“Description” id=“5” %} English