Does AnQiCMS support displaying the document list under a specific Tag on the frontend?

In the AnQi CMS, of course, you can easily display the document list under a specific Tag (label) on the frontend.This is not only a basic function of a content management system, but also through its flexible template tag system, it allows you to achieve this in a very fine and friendly manner, thus better organizing content, improving user experience, and the website's SEO performance.

From version 2.1.0 of AnQi CMS, the system has introduced a powerful article and product Tag label feature, which means you can now add one or more tags to your content (whether it's articles or products), associating documents of different categories but related themes.These tags are not only tools for backend management, they are designed to be displayed and interacted with directly on the frontend, becoming an important way for users to discover content.

To implement the document list display under a specific Tag on the front end, mainly some built-in template tags of the Anqi CMS will be used:tagList/tagDetailandtagDataListThey work together, allowing you to build a fully functional tag page.

Firstly,tagListThe label is mainly used to get all the tags on your website or a limited number of commonly used tags.You can use it to display various tags that users may be interested in on the website sidebar, footer, or a dedicated tag cloud page.

When a user clicks on a specific tag, they want to view all documents under that tag.tagDetailLabels can be put to use.It allows you to get detailed information about the specific tag, such as the name, description, and its exclusive link.This information can be used to build the title and introduction of the tab page, telling visitors which topic the current page is about.

The core feature, that is, to get the document list under a specific Tag, is bytagDataListLabels are implemented. This tag is specially designed to display documents associated with a label, and its usage is very intuitive and powerful.

When you create a tag list page (usuallytag/list.htmlSuch a template),tagDataListAutomatically detect the Tag ID contained in the current page URL and use it to obtain the corresponding document list. Of course, you can also throughtagIdParameters explicitly specify which Tag's documents to retrieve.

For example, if you want to display a list of articles under a certain tag and want each page to show 10 articles:

{# 假设这是标签列表页,系统会自动获取当前Tag的ID。我们先获取Tag的详情信息 #}
{% tagDetail currentTag with name="Title" %}
<h1>标签:{{ currentTag }}</h1>

{% tagDetail tagDescription with name="Description" %}
{% if tagDescription %}
<p>{{ tagDescription }}</p>
{% endif %}

<p>此标签下的相关文档:</p>
{% tagDataList archives with type="page" limit="10" %}
    {% for item in archives %}
    <article class="document-item">
        <h2><a href="{{ item.Link }}">{{ item.Title }}</a></h2>
        <p>{{ item.Description }}</p>
        <div class="meta-info">
            <span>发布日期:{{ stampToDate(item.CreatedTime, "2006-01-02") }}</span>
            <span>阅读量:{{ item.Views }}</span>
            {# 可以在这里显示文档所属分类等信息 #}
            {% categoryDetail categoryTitle with name="Title" id=item.CategoryId %}
            <span>分类:{{ categoryTitle }}</span>
        </div>
        {% if item.Thumb %}
        <div class="document-thumb">
            <a href="{{ item.Link }}"><img src="{{ item.Thumb }}" alt="{{ item.Title }}"></a>
        </div>
        {% endif %}
    </article>
    {% empty %}
    <p>这个标签下暂时还没有文档哦!</p>
    {% endfor %}

    {# 如果需要分页,可以接着使用 pagination 标签 #}
    <div class="pagination-wrapper">
        {% pagination pages with show="5" %}
            {# 这里是分页链接的展示代码,您可以根据自己的样式需求进行调整 #}
            {% if pages.FirstPage %} <a href="{{ pages.FirstPage.Link }}">首页</a> {% endif %}
            {% if pages.PrevPage %} <a href="{{ pages.PrevPage.Link }}">上一页</a> {% endif %}
            {% for p in pages.Pages %}
                <a href="{{ p.Link }}" class="{% if p.IsCurrent %}active{% endif %}">{{ p.Name }}</a>
            {% endfor %}
            {% if pages.NextPage %} <a href="{{ pages.NextPage.Link }}">下一页</a> {% endif %}
            {% if pages.LastPage %} <a href="{{ pages.LastPage.Link }}">末页</a> {% endif %}
        {% endpagination %}
    </div>
{% endtagDataList %}

In the above code snippet,tagDataListwill return a namedarchivesThe document array, you can useforLoop through this array, extract the title, link, description, publish time, and reading volume of each document, and display them according to the frontend style you design. If there are no documents under the current tag,emptyContent within the block will be displayed. At the same time,type="page"Parameters work togetherpaginationLabels can also implement pagination of lists, making content management more convenient and avoiding the slow loading speed and poor user experience caused by too long content on a single page.

In addition,tagDataListIt also supportsmoduleId参数,这意味着您可以指定只获取某个内容模型(例如“文章”模型或“产品”模型)下的标签文档列表,这对于拥有多种内容类型的网站来说,提供了极大的灵活性。

In summary, the document list display function under the specific Tag on the frontend of Anqi CMS is complete and easy to operate.Through the flexible use of the provided template tags, you can not only efficiently manage and display content, but also greatly enhance the organization structure of website content, improve the user experience in discovering content on your website, and help improve the crawling and understanding of website content by search engines.


Common Questions (FAQ)

1. How to ensure that the URL of the Tag list page is SEO-friendly?Auto CMS provides pseudo-static rule management feature, you can configure custom URL structure for tag pages, for example/tag/标签名称.htmlor/tags/标签别名/Set in the background "Function Management" under "Rewrite Rule" and make sure your template file (such astag/list.html)Matches these rules, thus generating clear, readable, and SEO-friendly URLs.

2. Besides the document list, what information can I display on the Tag page?On the Tag page, in addition to the document list, you can also usetagDetailLabel Obtain more information about the current Tag, such as its SEO title, keywords, and description. This information can be used on the page,<head>Part, improve the page's SEO performance. In addition, you can also show “Related Hot Tags” or “Tag Cloud” labels to guide users to find more relevant content.tagListTag display “Related Hot Tags” or “Tag Cloud”, guide users to discover more related content.

3. If my website has multiple content models (such as articles and products), can the Tag list differentiate and display?Yes, it can be done completely.tagDataListtag supportmoduleIdParameters. You can set throughmoduleId="1"Retrieve the documents associated with the current Tag under the article model, or setmoduleId="2"Get the document under the product model. This means you can flexibly display or merge the document list from different content models on the same Tag page according to your needs.