As an operator of the AnQiCMS website who is deeply involved in content operation, I am well aware of the importance of tags in content organization and user experience.Labels can not only help readers quickly find the content they are interested in, but are also a key element 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.

Tag management overview in AnQi CMS

In AnQiCMS background, the tag management feature allows us to create and maintain various tags for documents.These tags are independent of the category and content model and can be flexibly associated with different types of documents.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 easy addition, editing, and deletion operations, ensuring the accuracy and integrity of tag data.With these rich configurations, we can build a highly informative and SEO-friendly page for each tag.

Display tag details in the template

Display detailed information of a specific Tag tag on the front-end page, AnQiCMS provides powerful template tagstagDetail. This tag is designed to retrieve complete data for a single tag, whether it is for the tags on the current page, or for tags specified by ID or URL alias, it can be easily obtained.

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

Get tag name (Title)

The name of the tag can be accessed byname="Title"Parameter retrieval. 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 label's description information can be obtained throughname="Description"by parameters. This is a brief overview of the label content, which is very important for SEO and users to understand the meaning of the label.

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

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

Assign the tag description to a variable and output it # {% tagDetail tagDesc with name=“Description” %}

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

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

Description of tag ID 5: {% tagDetail with name=“Description” id=“5” %}