As an experienced website operations expert, I know that how to flexibly and efficiently display information in a content management system is the key to the success of a website.AnQiCMS (AnQiCMS) provides many conveniences in this aspect with its powerful functions.Today, let's delve deeply into a very practical and powerful template tag in AnQi CMS——Category detail tag(categoryDetail)See how it plays a core role in content operation.
The design philosophy of AnQi CMS is to provide users with a highly customizable, easy-to-expand content management platform that supports diverse content display.In the structure of website content, categories play a role of bridging the past and the future. They are not only the classification of content but also an important path for users to explore and for search engines to understand the structure of the website.And the "category detail tag" is exactly created to display these category information in the most abundant and convenient way for users.
The core function and value of the classification detail label
In simple terms, the 'classification detail label' is used in Anqi CMS forTo obtain and display all detailed information of a specific classificationThe tool. Different from the "Category List Tag" used to list multiple categoriescategoryListThe "Category Details Tag" focuses on extracting detailed data for a single category, including its basic attributes, media resources, and custom parameters.This allows website operators to build highly personalized, richly content categories on the front-end page based on this information.
Imagine a travel website's "European Travel" category page, where in addition to the title and introduction, you might also want to display a beautiful map of Europe as a cover, a long description of the European style, and even some "recommended destinations" or "visa注意事项" fields customized according to a classification model.All these needs can be met through the "Category Details Tag".
Rich application scenarios, helping content marketing and user experience
The strength of this tag lies in its wide range of application scenarios:
Build a dedicated category landing page:The most direct use is to create an independent detail page for each category. Here, you can use tags to get the title of the category (
Title) and detailed description (Description), even carefully edited categorization content (Content), let the user fully understand the themes and features covered by the category as soon as they enter it. For example, as mentioned in the "Document Classification Usage Help", the category description can be used as the description in the TDK tag, the category content editor has rich features, supporting various text operations, and all of these can be done throughcategoryDetailThe tag is displayed.Enhance navigation and breadcrumb experience:In the navigation structure of the website, users often need to understand the hierarchical relationship of the current category. By using the "Category Details Tag", you can easily obtain the parent ID of the category (
ParentIdThus, it helps to build a clear breadcrumb navigation, allowing users to quickly locate and improve the usability of the website. Although the breadcrumb navigation tag itself(breadcrumbThis function can be achieved, but in some scenarios that require fine-grained control over classification information,categoryDetailit can provide more flexibility.Strengthening visual appeal and brand image:Visual elements are crucial for attracting users. Through this tag, you can easily retrieve banner images (
Images) or thumbnails (Logo/Thumb) Apply it to the top Banner, sidebar, or list items of the category page. For example, in the "Document Classification Usage Help", it is clearly pointed out that categories can set Banner images and thumbnails, all of which are throughcategoryDetailto retrieve and render.Associate category information in the content list:When you are in the article list (such as using)
archiveListTags show multiple articles, each article will often belong to a certain category.At this time, you can nestly use the "Category Details Tag" in the article loop, obtain and display the name, link, even the thumbnail of the category according to the article category ID, making the list information more rich and guiding users to enter the relevant category.For example, when displaying a list of articles, displaying the name and link of the category to which each article belongs can greatly enhance the relevance of the content.SEO optimization and refined management:AnQi CMS attaches great importance to SEO, and category information is an important part of the SEO strategy. The "category detail tag" can directly output the title and description of the category (
Title,DescriptionThese are the key metadata that search engines crawl and understand page content.By coordinating with the SEO title and keywords set in the background, it can bring better search engine visibility to the category page.Display the number of documents under the category:In scenarios where an overview of information is needed, such as category navigation or category list pages, you may want to display how many articles are under each category. "Category Details Tag" provides
ArchiveCountThe field can conveniently display the total number of documents under the category, helping users quickly understand the richness of the category content.
How to conveniently use the 'Category Details Tag'
In Anqi CMS template files, the general syntax for using the "category detail tag" is:{% categoryDetail 变量名称 with name="字段名称" id="1" %}
There are several key points to understand:
name="字段名称"This is the core parameter, which tells the label which specific attribute of the category you want to get. For example,name="Title"It will retrieve the title of the category,name="Content"It will get the detailed content of the category.id="1"ortoken="your-category-alias"When you need to getspecific categoriesinformation whenidparameter to specify the category ID, or throughtokenparameter to specify the category URL alias. If neither of these parameters is specified, the tag willDefault to get the category information associated with the current page.变量名称: You can specify a variable name for the category information obtained (for examplecategoryInfo),so that the template code in subsequent templates can pass through{{categoryInfo.Title}}This way to refer. If you do not need to define a variable name, the label will directly output the value of the field.siteId: If your AnQi CMS has deployed multi-site management functionality and you need to retrieve category information from other sites, you can do so bysiteIdspecifying the site ID parameter.
The following are some practical applications of commonly used fields:
- Category Name:
{% categoryDetail with name="Title" %}Or{{category.Title}}(IncategoryDetailwhen defined ascategorya variable). - Category link:
{% categoryDetail with name="Link" %}, generating clickable category URLs. - Category description:
{% categoryDetail with name="Description" %}It is usually used in HTML meta tags or page descriptions. - Detailed category content:
{% categoryDetail with name="Content" %}. If the category content includes Markdown format, you can add it additionally.render=trueParameters make it rendered as HTML, for example{% categoryDetail with name="Content" render=true %}. - Category thumbnail/Banner image:
{% categoryDetail with name="Logo" %}(Large image),{% categoryDetail with name="Thumb" %}(thumbnail) or{% categoryDetail categoryImages with name="Images" %}(Multiple Banner images, usually need to be accompanied byforloop traversal). - Document count under category:
{% categoryDetail with name="ArchiveCount" %}.
Custom field call: AnQi CMS allows you to customize additional fields for content models and categories (as described in the "Content Model Usage Help"). These custom fields can also be accessed throughcategoryDetailTag to retrieve. For example, if you add a field named in the backgroundcontactPersonyou can call it like this:{% categoryDetail with name="contactPerson" %}. If you need to display all custom fields in a loop, you can use{% categoryDetail extras with name="Extra" %}and then iterate overextrasVariable.
Through these flexible parameter settings and field acquisition, website operators can meet actual needs, presenting category information in the most aesthetically pleasing,