How to retrieve and display the name, description, and thumbnail of a specific category?

Calendar 👁️ 64

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

Related articles

How to use the `categoryList` tag to display the list of articles/products categories on the homepage or sidebar?

When building and optimizing a website, a clear navigation structure is crucial for user experience and search engine optimization.AnQiCMS (AnQiCMS) provides us with powerful template tags, among which the `categoryList` tag is a core tool used to flexibly display article or product category lists on the homepage or sidebar of the website.With it, we can easily organize the content of the website neatly, allowing visitors to find the information they are interested in at a glance.Why is the category list so important? Imagine when visitors come to a rich content website

2025-11-08

How to automatically generate breadcrumb navigation using the `breadcrumb` tag and customize the display text on the homepage?

The user experience of a website largely depends on the convenience and clarity of navigation.When the visitor delves into the website content, a friendly 'Breadcrumb Navigation' can clearly indicate the current position and provide a quick path to return to the upper page.AnQiCMS is well-versed in this, providing a powerful and easy-to-use `breadcrumb` tag that allows website administrators to automatically generate paths without complex coding, and even to flexibly customize the display text on the homepage.

2025-11-08

How to use the `navList` tag to build a website navigation menu with secondary dropdown?

Build a clear and easy-to-use website navigation menu is an important link to improve user experience and website professionalism.In AnQi CMS, we can take advantage of the powerful `navList` tag to easily implement a navigation menu with secondary dropdown support, making the website content well-structured and convenient for visitors to browse.Next, we will explore how to use the `navList` tag, from backend configuration to frontend template rendering, step by step to create a complete second-level dropdown navigation.

2025-11-08

How to dynamically generate the page's Title, Keywords, and Description (TDK) to optimize SEO display?

In website operation, Title (title), Keywords (keywords) and Description (description) - abbreviated as TDK, are the core elements of search engine optimization (SEO).They directly affect the display of the website on the search engine results page (SERP), thereby determining the click-through rate and traffic of the website.For a content-rich website, manually setting TDK for each page is neither realistic nor efficient.

2025-11-08

How are the `pageList` and `pageDetail` tags used to display single-page content such as 'About Us'?

In website operation, content such as 'About Us', 'Contact Information', or 'Service Introduction' usually exists as independent pages, which we call 'single pages'.They do not update as frequently as blog posts, but they are essential core information for the website.AnQi CMS provides the `pageList` and `pageDetail` tags, allowing you to manage and display these single-page contents flexibly and efficiently.

2025-11-08

How does the `archiveList` tag display the article list based on categories, recommended attributes, or custom sorting?

In the Anqi CMS template system, the `archiveList` tag is the core tool for building dynamic content lists.Whether it is a blog article list, product display page, or news information module, `archiveList` can help you accurately filter, sort, and present content according to your diverse needs, bringing vitality to your website content area.

2025-11-08

How to display article title, content, images, etc. on the document detail page using the `archiveDetail` tag?

Manage website content in Anqi CMS, the document detail page is undoubtedly the core position for users to obtain information.How to present each carefully written article, its title, content, images, and various additional information accurately and vividly to the user, this requires the clever use of our `archiveDetail` tag.This tag is specifically designed to display the details of a single document, and its flexible use will help you easily build a feature-rich and smooth experience detail page.

2025-11-08

How to implement the previous/next document function using `prevArchive` and `nextArchive` tags?

When you operate a website, providing a smooth reading experience for users is one of the key factors in enhancing website stickiness.When a user finishes reading a document, if they can easily jump to the previous or next related article, it will undoubtedly greatly increase their stay time on your website.AnQiCMS (AnQiCMS) understands this and provides very intuitive and powerful `prevArchive` and `nextArchive` tags to help you easily implement this feature.

2025-11-08