As an experienced website operator for AnQi CMS, I am well aware of the importance of tags in content management and user experience.Tags can not only help us better organize content, improve the SEO performance of the website, but also guide users to discover more interesting information.Next, I will introduce how to create, manage, and call document tags in AnQiCMS to help you operate your website.

The role and value of tags in AnQiCMS

Create and edit document tags

AnQiCMS provides two main ways to create tags: in real-time during the document publishing process, or through the tag management feature in the background for centralized creation and editing.

When you create or edit articles, products, and other documents, you will find the "Tag label" field.You can add one or more tags to the current document here.AnQiCMS allows you to select existing tags in the system, or you can directly enter new tag text, then press the Enter key to quickly create a new tag and associate it with the current document.This convenient operation method allows content creators to set tags immediately based on the document content.

Tag management and features

In the label management background, you can view all the created label lists at any time and edit their various properties.For example, you can change the display name of the label, update SEO information, or adjust the custom URL.When the label is no longer needed, it can also be deleted.The design of AnQiCMS aims to provide a simple and efficient tag management experience, ensuring that website operators can easily maintain and optimize the tag system.

Call document tags in the template

In AnQiCMS template design, calling label data mainly relies on a series of dedicated template tags, which are based on Django template engine syntax, allowing you to flexibly display tags and their associated content.

Invoke the tags associated with the document

On the document details page or in the document list, if you want to display the tags associated with the current document, you can usetagListTag. It allows you to get the tag list of a specific document and display it in a loop. For example:

{# 在文档详情页或其他需要展示文档标签的地方 #}
<div>
    <strong>文档标签:</strong>
    {% tagList tags with itemId=archive.Id limit="10" %} {# archive.Id 代表当前文档的ID #}
        {% for item in tags %}
            <a href="{{item.Link}}">{{item.Title}}</a>
        {% endfor %}
    {% endtagList %}
</div>

Get all tag lists

If you want to display a list of popular tags or an index of all tags in a certain area of the website (such as the sidebar, footer), you can usetagListlabel and specifyitemId="0"To obtain the label set of non-specific documents, or throughletterFilter specific initial letter labels through parameterslimitParameter control the number of displayed items.

{# 展示所有标签或热门标签(假设后台有排序逻辑或手动选择) #}
<h3>热门标签</h3>
<ul>
    {% tagList tags with limit="20" %} {# 获取前20个标签 #}
        {% for item in tags %}
            <li><a href="{{item.Link}}">{{item.Title}}</a></li>
        {% endfor %}
    {% endtagList %}
</ul>

Display detailed information of specific tags

When a user visits a tab (such as/tag/SEO.html), you may need to display the detailed information of the tab, including its name, description, SEO title, etc.tagDetailThe tag can help you get the detailed data of the current tab:

{# 在标签详情页 (tag/detail.html 或 tag/index.html) #}
<h1>{{% tagDetail with name="Title" %}}</h1>
<meta name="description" content="{{% tagDetail with name="Description" %}}">
<p>标签描述:{{% tagDetail with name="Content" %}|safe}}</p>

List all documents under a certain tag

The core function of the tab page is to display all related documents under the tag.tagDataListTags are specifically used for this purpose, it will automatically retrieve and paginate the list of all associated documents based on the ID of the current tab:

{# 在标签详情页,列出该标签下的文档 #}
<h2>“{{% tagDetail with name="Title" %}}” 相关文档</h2>
{% tagDataList archives with type="page" limit="10" %}
    {% for item in archives %}
        <div>
            <a href="{{item.Link}}">
                <h3>{{item.Title}}</h3>
                <p>{{item.Description}}</p>
            </a>
        </div>
    {% endfor %}
{% endtagDataList %}

{# 分页导航 #}
<div>
    {% pagination pages with show="5" %}
        {# 包含首页、上一页、页码、下一页、尾页等分页链接 #}
        {% if pages.FirstPage %}<a href="{{pages.FirstPage.Link}}">首页</a>{% endif %}
        {# ... 其他分页逻辑 ... #}
    {% endpagination %}
</div>

By way of the above creation, management, and invocation methods, the tag feature of AnQiCMS can help website operators build an efficient, flexible, and SEO-friendly content system, thereby better attracting and retaining users.


Frequently Asked Questions (FAQ)

How does AnQiCMS tag improve the website's SEO performance?

What is the difference between tags and categories, and how should they be used?

Labels and categories are both ways to organize content, but they have different focuses.Categories are typically hierarchical, with clear boundaries, used to classify content into major categories, such as 'News and Information', 'Product Introduction', etc.And the tags are flattened, more focused on describing the specific topic or attribute of the content, which can cross categories and be more flexible in association.For example, an article belongs to the 'News Information' category, but can also be tagged with 'Artificial Intelligence', 'Technology Frontier', 'Industry Analysis', and so on.When in use, core and stable content structures should be placed in categories, while refined, cross-domain topics or keywords should be set as tags to provide richer user navigation and SEO dimensions.

Can AnQiCMS tags be associated with all types of content models?

Yes, the tag design of AnQiCMS has high versatility.“Document tags are not classified and modeled”, which means that any tag you create can theoretically be associated with all content models that support tag functions such as articles, products, and pages.