How to use the `tagDetail` and `tagDataList` tags to display information about a specific tab page and its associated documents?

Calendar 👁️ 69

AnQiCMS (AnQiCMS) is a flexible and efficient content management tool trusted by many operators.It is crucial to effectively demonstrate content categorization and organization when building a functional and user-friendly website.tagDetailandtagDataListThe use of these template tags can make your website tab page not only beautiful but also informative, greatly enhancing the user experience and search engine optimization (SEO) effect.

Understand the value of tags in content management

In content operations, tags (Tag) are a powerful way to organize content.It is different from the traditional classification (Category), which is usually hierarchical and structured, while tags are more flexible and flat.By tagging documents, products, and other content with multiple relevant tags, you can achieve cross-category content association, allowing users to quickly find more related content based on their interests.At the same time, well-designed tabs also have a positive effect on SEO, as they can provide more internal links for search engines, increasing the chance of content inclusion and keyword ranking.

AnQiCMS knows the importance of tags and provides a comprehensive "Document Tag" management function, allowing you to create, manage tags, and set names, descriptions, custom URLs, and other information for each tag.When a user clicks on a tag on your website, they are usually directed to a dedicated tag detail page, displaying the detailed information of the tag and all associated documents.In order to build such a page, we will focus on usingtagDetailandtagDataListThese tags.

tagDetail: Display detailed information of specific tags

When a user visits a tag page, they first hope to clearly know what the tag represents.tagDetailThe tag is born for this, it allows you to get specific information about the current tag page, such as the name, description, and link.

In most cases, in the tag detail page (for example, in the template directory oftag/list.htmlortag/index.htmlthe file),tagDetailThe tag does not need to be specified with an ID or alias, it will automatically recognize the tag information on the current page and render it.

For example, to display the label name in the title section of the page and to display its description on the page, you can use it like thistagDetail:

<div class="tag-header">
    {# 获取当前标签的标题作为页面主标题 #}
    <h1>{% tagDetail with name="Title" %}</h1>

    {# 获取当前标签的描述信息,并判断是否存在后显示 #}
    {% tagDetail tagDescription with name="Description" %}
    {% if tagDescription %}
        <p class="tag-description">{{ tagDescription }}</p>
    {% endif %}

    {# 如果需要显示标签的索引字母,也可以这样获取 #}
    <span class="tag-first-letter">标签索引字母:{% tagDetail with name="FirstLetter" %}</span>
</div>

In the code above,tagDetail with name="Title"It directly outputs the current label name, and{% tagDetail tagDescription with name="Description" %}Then the tag description is assigned totagDescriptionVariables, convenient for us to make further judgments and processing, ensuring that only when the description content exists will the corresponding HTML element be rendered.This way, your tab can clearly convey the meaning to the visitor.

tagDataList: Gather the associated documents under the tag

The core value of the tag page lies in displaying all the content related to the tag.tagDataListTags are designed to meet this need, they can retrieve the list of all associated documents under the specified tag.

On the tag detail page,tagDataListIt can also intelligently recognize the current tag without manual passingtagIdParameters. Just tell it how you want to display these documents, such as how many items per page, whether to paginate, how to sort, and so on.

Considering user browsing habits and SEO requirements, we usually display related documents in a paginated form. At this time,tagDataListoftype="page"Parameters are particularly important, as they are related to the pagination tags of AnQiCMSpaginationCooperation can build a complete document list with pagination.

This is an example of a document associated with a display tag and with pagination functionality

<div class="tag-content-list">
    {# 使用tagDataList获取当前标签下的文档列表,并启用分页,每页显示10条 #}
    {% tagDataList archives with type="page" limit="10" %}
        {% for item in archives %}
            <article class="document-item">
                <h2><a href="{{ item.Link }}">{{ item.Title }}</a></h2>
                {% if item.Thumb %}
                    <a href="{{ item.Link }}">
                        <img src="{{ item.Thumb }}" alt="{{ item.Title }}" class="document-thumb">
                    </a>
                {% endif %}
                <p class="document-description">{{ item.Description|truncatechars:150 }}</p>
                <div class="document-meta">
                    <span>发布时间: {{ stampToDate(item.CreatedTime, "2006-01-02") }}</span>
                    <span>浏览量: {{ item.Views }}</span>
                </div>
            </article>
        {% empty %}
            <p class="no-content-message">该标签下暂时没有找到相关文档。</p>
        {% endfor %}

        {# 结合pagination标签生成分页导航 #}
        {% pagination pages with show="5" %}
            <div class="pagination-nav">
                {# 上一页链接 #}
                {% if pages.PrevPage %}<a href="{{ pages.PrevPage.Link }}" class="page-link prev">上一页</a>{% endif %}

                {# 中间页码链接 #}
                {% for item in pages.Pages %}
                    <a class="page-link {% if item.IsCurrent %}active{% endif %}" href="{{ item.Link }}">{{ item.Name }}</a>
                {% endfor %}

                {# 下一页链接 #}
                {% if pages.NextPage %}<a href="{{ pages.NextPage.Link }}" class="page-link next">下一页</a>{% endif %}
            </div>
        {% endpagination %}
    {% endtagDataList %}
</div>

In this example,tagDataListLoop through the obtainedarchives(Document list), for each document, we display its title, thumbnail, description, publication time, and page views, and add links to the document detail page for the title and thumbnail. At the same time, using{% empty %}Block, we elegantly handled the case when there are no documents under the tag, giving the user a friendly prompt.

Integrated Application: Build a feature-complete tag detail page.

totagDetailandtagDataListTags combined can easily build an informative and feature-rich tag detail page.This page not only clearly displays the information of the tag itself, but also lists all related documents in order and provides convenient pagination navigation.

A typical label detail page template structure may include the following parts:

  1. Page metadata (<head>Area):UtilizetdkLabel dynamic settings page

Related articles

What are the applications of the `pageDetail` and `pageList` tags in displaying single-page content and list presentation?

When using AnQiCMS to build a website, the display of single-page content and page lists is an indispensable part.Whether it is an independent content page like "About Us" or a series of links in the website footer navigation, they all need flexible and efficient ways to manage and present.In AnQiCMS, the `pageDetail` and `pageList` tags are powerful tools designed to meet these needs.They each focus on different application scenarios and yet complement each other

2025-11-08

How to use the `categoryList` tag to build a multi-level category navigation and control its display level?

The website's navigation system is like a map, guiding visitors smoothly to their destination.A well-organized, layered classification navigation that can significantly improve the user's browsing experience and also help search engines understand and index your website content more efficiently.In AnQi CMS, the `categoryList` tag is the tool to build a high-efficiency and flexible category navigation system.With it, you can easily display the website's category structure, even fine-tune the display level of each category.### `categoryList` Label Overview

2025-11-08

How does the `categoryDetail` tag help us retrieve and display detailed information for a specific category?

AnQiCMS (AnQiCMS) provides powerful and flexible tools for website content management, among which the `categoryDetail` tag plays a very important role in building a rich and structured website.It can help us accurately obtain and display detailed information about specific categories, whether it is used for the header introduction on the category list page or to display more content about the category in the article detail page, it is very convenient.### `categoryDetail` tag basic usage In simple terms

2025-11-08

How to use the `archiveList` tag to display document lists on different page types (such as lists, pagination, related documents)?

AnQi CMS provides strong support for website operators with its efficient and flexible content management capabilities.Among many practical features, the `archiveList` tag plays a core role, and it is a powerful tool for displaying various document lists on your website's front end.No matter if you want to display the latest articles on the homepage, present specific content on the category page, or recommend relevant information on the detail page, `archiveList` can help you achieve it with concise syntax.By reasonably configuring the `archiveList` tag parameters, you can easily master the way content is presented

2025-11-08

How to implement the `navList` tag for flexible display of top, bottom, or sidebar navigation menus on a website?

The website navigation is a guide for users to explore the website content and is also an important clue for search engines to understand the website structure.A well-designed, flexible navigation system that can greatly enhance user experience and website SEO performance.In AnQiCMS, the `navList` tag is just such a core tool that gives us great freedom, allowing us to easily build and manage navigation menus at various positions such as the top, bottom, and sidebars of the website.

2025-11-08

How to build a clear breadcrumb navigation through `breadcrumb` tags to enhance users' sense of positioning on the website?

In website operation, how to keep visitors from getting lost in the vast content while browsing, and maintain a clear sense of orientation, is a crucial issue.Imagine if a user delves into a page on a website and is unclear about where they came from or their level, they are likely to feel confused and even choose to leave.At this time, a well-designed and functional breadcrumb navigation can play a key role, it is like a 'road sign' in the digital world, providing users with a clear return path.AnQiCMS (AnQiCMS) is deeply skilled in content management and user experience

2025-11-08

How is the `bannerList` tag used to fetch and display the carousel of the website homepage or a specific group?

When building modern websites, the banner carousel is a commonly used element to enhance visual appeal and convey important information.They are usually located in prominent positions on websites, such as the top of the homepage, to display the latest activities, featured products, or important announcements.In AnQiCMS (AnQiCMS), managing and displaying these carousel images becomes very convenient, mainly due to its powerful template tag system, especially the `bannerList` tag.`bannerList`

2025-11-08

What global website information and contact details can the `system` tag and `contact` tag retrieve and display?

In the daily operation of AnQiCMS, the global information and contact information of the website are highly concerned by users and frequently change.How to efficiently and uniformly manage and display this information is an important standard for measuring the flexibility of a content management system.AnQiCMS provides an extremely convenient solution for calling website content and contact information through its unique template tag system, especially the core tags `system` and `contact`.

2025-11-08