Today, with the increasing complexity of content management, how can website operators efficiently organize and present website content, allowing users to easily find the information they are interested in while improving the website's search engine performance, is a problem that every website operator is thinking about.AnQiCMS provides a series of powerful functions to meet these challenges, among which, the Tag label function is undoubtedly a great tool for connecting and enriching content relationships.
Tag, as the name implies, is like various small tags attached to articles or products, which can cross traditional classification boundaries and cleverly associate content with the same theme, keywords, or attributes.Different from the hierarchies and exclusivity of categories, tags are more flexible and inclusive. A document can belong to one category but can also have multiple tags, thus being discovered from different dimensions by users and search engines.
Backend settings and management: Tag content
On the AnQiCMS backend, adding a Tag tag to a document is an intuitive and simple process.When you enter the "Content Management" module, whether it is to "publish documents" or edit existing documents, you will find a region named "Tag Tag" on the editing interface.
Here, you can freely enter keywords or topics related to the document content as tags.For example, an article about 'AnQiCMS Deployment Tutorial', you can add tags such as 'AnQiCMS', 'Deployment', 'Tutorial', 'GoLang', 'CMS', etc.After entering a label, press the Enter key and it will automatically convert it into an independent label.It is more convenient that the system will intelligently prompt you with existing tags, you can directly select them to avoid creating duplicates.
The value of these tags lies in the fact that they are not limited to a specific category or content model.That is to say, an article about "AnQiCMS Deployment" and a product introducing "AnQiCMS Theme Templates" will establish a connection through the "AnQiCMS" tag if both are labeled with it, even though they belong to different content models and categories.
In addition, AnQiCMS also provides an independent "Document Tag Management" page, allowing you to centrally manage all tags on the website.Here, you can edit the label name, set a custom URL (which is crucial for SEO optimization), fill in the SEO title and description, and even add index letters and an introduction to the label.These detailed settings make each tag itself an independent 'content theme page' with good SEO-friendliness.
Front-end display and content association: make the label come alive
On the front-end page, AnQiCMS presents these carefully set Tag tags vividly to the users and establishes deep connections between the content in this way.
1. Display related tags on the document detail page
When a user reads a document, they often hope to find more content on similar topics. In AnQiCMS, you can do this in the template of the article or product detail page, usually{模型table}/detail.htmlIn it, easily call up all tags associated with the current document.
UsetagListTags, you can list all tags in the current document and generate clickable links for each tag. For example:
{# 在文档详情页,显示当前文档的所有标签 #}
<div>
相关标签:
{% tagList tags with limit="10" %}
{% for item in tags %}
<a href="{{item.Link}}">{{item.Title}}</a>
{% endfor %}
{% endtagList %}
</div>
After reading a document, users can click on these tags to directly jump to more content on the same theme, greatly improving the efficiency and user experience of content discovery.
2. Build a website tag cloud or popular tag list
To help users better understand the popular topics covered by the website, you can display a tag cloud or a list of hot tags in the website's sidebar, footer, or a dedicated tab page. This can be done bytagListtags, and specifyitemId="0"Or to get all tagslimitParameter to implement:
{# 在网站首页或侧边栏,显示全站热门标签 #}
<div>
热门标签:
{% tagList tags with itemId="0" limit="20" %} {# itemId="0"表示获取所有标签,limit限制数量 #}
{% for item in tags %}
<a href="{{item.Link}}">{{item.Title}}</a>
{% endfor %}
{% endtagList %}
</div>
You can even combinecategoryIdParameter to implement 'Display popular tags used by relevant documents under a certain category', further refining the range of tag display.
3. Create an independent tag aggregation page
When a user clicks on a label, they expect to see a dedicated page that gathers all documents with that label. AnQiCMS provides a dedicated template file (usuallytag/list.htmlortag/index.htmlTo bear these pages and make use oftagDataListtags to achieve this core function.
On these tag aggregation pages,tagDataListThe tag automatically identifies the tag ID of the current page and retrieves the list of all associated documents. It also supports pagination to ensure that even if the amount of content under the tag is large, it can be displayed smoothly:
"twig {# On the tag aggregation page (such as tag/list.html), display all documents under the current tag #}
<h1>标签:{% tagDetail with name="Title" %}</h1> {# 显示当前标签的标题 #}
<p>{% tagDetail with name="Description" %}</p> {# 显示当前标签的描述 #}
{% tagDataList archives with type="page" limit="10" %}
{% for item in archives %}
<li>
<a href="{{item