In website operation, clearly and effectively displaying classification information is crucial for user experience and search engine optimization.A specific category name can help users quickly understand the content topic, a concise description can provide more background information, and a direct thumbnail can attract users to click.AnQiCMS (AnQiCMS) provides a powerful and flexible template tag feature, allowing you to easily obtain and display these key category information, whether it is to build navigation menus, design category list pages, or optimize search engine results.

Get the name and description of the category

AnQi CMS through its concise template tag system makes it very direct to obtain category information. To display the name and description of a specific category, we will usecategoryDetailLabel. This label is used to retrieve detailed data for a specified category.

First, you need to know the unique identifier of the target category.This is typically the category ID or its custom URL alias (token).This information can be found in the "Content Management" -> "Document Category" section of the AnQi CMS backend.Click the category you want to get information about, and the editing page will display its ID and custom URL alias.

Once you have the category ID or token, you can use it in the template.categoryDetailLabel to get its name. For example, if you want to get the ID of1category name, you can write it like this:

{% categoryDetail myCategoryTitle with name="Title" id="1" %}
{{ myCategoryTitle }}

Similarly, to get the description of the category, just change thenameparameter to"Description":

{% categoryDetail myCategoryDescription with name="Description" id="1" %}
{{ myCategoryDescription }}

Please note that if the category description may contain HTML tags, you can use|safeThe filter ensures that these tags can be correctly parsed and rendered by the browser instead of being displayed as plain text. To handle it more flexibly, we usually providecategoryDetailLabel defines a variable name to hold the result, then apply|safea filter. For example:

{% categoryDetail myCategoryDescription with name="Description" id="1" %}
<p>{{ myCategoryDescription | safe }}</p>

Thus,myCategoryDescriptionThe variable will store the description of the category, you can place