How to retrieve detailed information for a specified category, such as the category name, description, and link?

Calendar 👁️ 61

As an expert in the operation of AnQiCMS, I am well aware of the importance of classified information in constructing website structure and enhancing user experience.The AnQi CMS, with its intuitive and powerful template tag system, makes it extremely easy to obtain and display detailed information about categories.In order to optimize navigation, enrich page content, or improve SEO effect, accurately obtaining category names, descriptions, and links is an indispensable part of our daily operations.

The core of AnQi CMS lies in its flexible template tags, and for obtaining category information,categoryDetailThe tag is undoubtedly our main tool.This tag is specifically designed to extract the properties of a single category.It not only intelligently identifies and displays the detailed information of the current page category, but also supports obtaining data of any specific category by explicitly specifying the category ID or URL alias, which greatly enhances the flexibility and customization of content display.

To obtain the category ofnamewe can use it in the template.{% categoryDetail with name="Title" %}.This label will directly output the display name of the category.For example, on the "News Center{% categoryDetail with name="Title" id="10" %}. This 'name' is exactly the 'category name' field we set for the category in the 'document category' management interface of the AnQi CMS backend.

category ofdescriptionInformation is equally important for users to understand the classification content and for search engine optimization. Through{% categoryDetail with name="Description" %}We can easily obtain and display the introduction of the category.This corresponds to the 'Category Introduction' field in the background 'Document Category'.<meta name="description">The content of tags can enhance the crawling and ranking effect of search engines.

To get the classification oflinks(URL address) is the key to guiding users to browse and build website navigation. Using{% categoryDetail with name="Link" %}Label, you can get the complete URL of the category.The Anqi CMS will automatically generate and manage these links according to the static rules you configure in the background, as well as the 'Custom URL' field of the category.Whether it is a clear navigation menu or a classified jump in the article list, this link tag ensures the consistency of the website structure and the convenience of user access.

In addition to the above basic information,categoryDetailTags also provide the ability to obtain deeper classification metadata, such asParentId(Parent Category ID), This is crucial for building a clear hierarchy navigation menu or breadcrumb navigation. Moreover, you can easily obtain the visual elements of the category, such asLogo(Category thumbnail large image),Thumb(Category thumbnail) as wellImages(Category banner group image, usually an array of images, which can be used for carousel display). If your category model defines additional custom fields in the background, you can also specifyname="自定义字段名"In order to call these personalized data, thus achieving highly customized content display requirements.

For example, in your template, if you want to display all the core information of the current category, you can organize the code like this:

<div class="category-info-block">
    <h1>{{ categoryDetail with name="Title" }}</h1>
    <p>{{ categoryDetail with name="Description" }}</p>
    <a href="{{ categoryDetail with name="Link" }}" title="更多关于{{ categoryDetail with name="Title" }}的内容">探索更多</a>
    {% if categoryDetail with name="Logo" %}
    <img src="{{ categoryDetail with name="Logo" }}" alt="{{ categoryDetail with name="Title" }}" class="category-logo" />
    {% endif %}
</div>

Provided by Anqi CMScategoryDetailLabel, website operators can manage and display categorized content in an extremely flexible and efficient manner.This not only simplifies the template development process, but more importantly, it empowers us to build websites with clear structure, rich content, and SEO-friendly, thereby better serving our users and operational goals.


Frequently Asked Questions (FAQ)

  1. How can I get and display the names and links of multiple categories in a loop without entering the category detail page? Answer:You can usecategoryListtag to get a collection of categories. For example,{% categoryList categories with moduleId="1" parentId="0" %}Get all top-level categories under the article model. In{% for item in categories %}loop, you can access it directly through{{ item.Title }}Get the category name and pass through{{ item.Link }}Get the category link. This method is suitable for building the main navigation menu or sidebar category list without using it separately for each category.categoryDetail.

  2. Ask: How can I call the Banner image and thumbnail images uploaded in the background in the front-end template? Answer:The Anqi CMS supports configuring Banner images and thumbnails for categories. To get the Banner image group for a category, you can use{% categoryDetail categoryImages with name="Images" %}It will return an array of image URLs, which you can iterate over in the template to display these images. The thumbnails for categories can be accessed through{% categoryDetail with name="Logo" %}(usually refers to the large image) or{% categoryDetail with name="Thumb" %}(referring to the cropped or compressed thumbnail) to obtain.

  3. Question: If I add custom fields for categories in the background, how can I display these custom information in the frontend template? Answer:After you add custom fields to a category model in the background "Content Model", the values of these fields can also be accessed throughcategoryDetailInvoke a label. For example, if you define a custom field named "Color" for categories, you can use it in the template.{% categoryDetail with name="颜色" %}Display the color value corresponding to the category. If you need to cycle through all custom fields, you can first use{% categoryDetail extras with name="Extra" %}Get all custom fields as a collection, and then in aforTraverse in a loopextrasAccess a variable{{ field.Name }}and{{ field.Value }}To display field names and values.

Related articles

How to get the classification list under a specific content model (such as articles, products)?

As an experienced CMS website operation personnel for Anqi, I know the importance of content organization and user experience for the success of the website.Accurately display content categories, not only can help users quickly find the information they are interested in, but also improve the overall SEO performance of the website.Today, we will delve into how to obtain the category list under specific content models (such as articles, products) in AnQiCMS, which is crucial for building clear website navigation, content aggregation modules, and special pages.

2025-11-06

How to correctly generate and display breadcrumb navigation on a page?

As an experienced CMS website operation person in an enterprise, I am very clear about the importance of breadcrumb navigation in improving user experience and website SEO.It not only helps visitors clearly understand their position on the website, but also guides search engines to better understand the website's hierarchical structure.In AnQi CMS, correctly generating and displaying breadcrumb navigation is a fundamental and important content management task.

2025-11-06

How to display a website navigation menu and support multi-level dropdown navigation?

As an experienced CMS website operation personnel of an enterprise, I know that a well-organized and easy-to-use navigation menu is crucial for the website user experience and content discovery.AnQi CMS provides a powerful and flexible navigation management function, which can help us easily set up the main menu of the website and also support multi-level dropdown navigation to meet the needs of complex website structures. ### Backend Navigation Configuration: Build Menu Structure The setting of the navigation menu in AnQi CMS starts from the backend management interface.

2025-11-06

How to dynamically set and call the SEO title, keywords, and description (TDK) of the current page in the template?

As an experienced CMS website operation personnel in a cybersecurity company, I am well aware that high-quality content and excellent search engine optimization (SEO) are the foundation of a website's success.Among them, the SEO title (Title), keywords (Keywords), and description (Description) of the page, abbreviated as TDK, play a vital role.They are not only the key for search engines to understand the content of a page, but also an important factor in attracting users to click.In Anqi CMS, we have flexible and powerful mechanisms to dynamically set and call these TDK information

2025-11-06

How to get the list of all single-page lists of a website?

As an experienced CMS website operation personnel of an enterprise, I know the importance of acquiring and managing website content, especially for single pages carrying core information such as 'About Us', 'Contact Information', or 'Terms of Service'.In AnQi CMS, the system provides an efficient and flexible way to obtain the list of these single pages, so that we can integrate them into website navigation, site map, or other display locations.

2025-11-06

How to get and display the title, content, and link of a specific single-page?

As an experienced CMS website operation person, I know that content is the soul of the website, and how to efficiently and accurately display content is a crucial link in our daily work.In Anqi CMS, a single page usually carries the core information of the company introduction, contact information, service description, etc., and its content often needs to be specifically retrieved and displayed in various corners of the website.Today, let's discuss in detail how to obtain and display the title, content, and link of a specific single page in Anqi CMS.

2025-11-06

How to get the list of the latest published or articles/products under a specified category?

As an experienced AnQiCMS (AnQiCMS) website operator, I am well aware of the importance of content presentation for website user experience and the effectiveness of content marketing.AnQi CMS provides a powerful and flexible template tag system that allows us to easily retrieve and display various types of articles and product lists, whether it is for the latest content updates or for special topic displays under specific categories, all can be achieved through simple configuration.

2025-11-06

How to display the title, content, images, and other detailed information of the current content on an article or product detail page?

As a senior security CMS website operator, I know that the content detail page is a core component of the website, carrying the important mission of displaying key information such as products and articles to users.A well-designed, comprehensive detail page that not only effectively conveys content value but also enhances user experience and SEO performance.Strong and flexible template tags provided by Anqi CMS, allowing us to easily control the display of each item on the page.

2025-11-06