As an experienced website operations expert, I am well aware of the importance of tag management for website content organization and search engine optimization.In AnQiCMS, the tag (Tag) is not only a content classification tool, but also a bridge connecting user interests with website content.{% tagDetail %}This powerful template tag accurately retrieves the detailed information of a specific tag, especially its description content and custom URL, thus better serving the operation and SEO of the website.
Know{% tagDetail %}English: Label information acquisition tool
In the template system of Anqi CMS,{% tagDetail %}Labels play a key role in obtaining detailed information about a single tag.It allows you to flexibly retrieve rich data of specified tags on any page of the website, whether it's a tag aggregation page, article detail page, or other custom page.This is crucial for building personalized tag display, optimizing the SEO elements of the tag page, and implementing a more accurate internal link strategy.
The basic usage is very intuitive, you can choose to directly output a field, or assign all the information of the label to a variable for more convenient referencing in the template.
核心功能一:获取标签描述信息(English)Description)
Behind each meticulously set label, there should be a concise description, which not only helps visitors quickly understand the connotation of the label, but is also an indispensable part of search engine optimization (SEO). In the Anqi CMS background, the 'label introduction' you fill in when editing the label is exactly{% tagDetail %}Tags can be used toname="Description"Parameter content obtained.
For example, if you want to display the introduction of the tab at the top of the tab page, or use it on the page,meta descriptionto improve SEO effect, you can call it like this:
{# 假设当前页面是某个标签的详情页,会自动获取当前标签的描述 #}
<meta name="description" content="{% tagDetail with name="Description" %}" />
{# 如果需要获取指定ID标签的描述,例如ID为10的标签 #}
{% tagDetail specificTagDesc with name="Description" id="10" %}
<p>关于此标签的介绍:{{ specificTagDesc }}</p>
This description is the key to conveying the page theme and content summary to search engines, which can directly affect the display of your website in search results. Make good use of it.DescriptionEnglish translation: Can significantly increase click-through rate, guide more potential users to visit your website.
English translation: Core feature two: Master the custom URL (Link)
An clear and meaningful URL is the key to website user experience and SEO.In the Auto CMS, you can set a 'custom URL' for each tag, which makes the link address of the tag more friendly and semantic.{% tagDetail %}Tagsname="Link"Parameter, it is used to obtain the final link address after the pseudo-static rule processing.
This means that no matter how you configure the pseudo-static rule of the label in the background (such as/tags/{token}.htmlor/tag/{id}.html)LinkFields will automatically output the correct, accessible URL for the tag. This is very convenient for building tag navigation, breadcrumb navigation, and inserting related tag links in articles.
This is an example of calling the tag link:
{# 在标签详情页,获取当前标签的链接,可用于面包屑或分享按钮 #}
<a href="{% tagDetail with name="Link" %}">查看所有相关文章</a>
{# 获取ID为10的标签的链接,用于在其他页面引用 #}
{% tagDetail specificTagLink with name="Link" id="10" %}
<p>前往ID为10的标签页:<a href="{{ specificTagLink }}">点击这里</a></p>
PassLinkThe field ensures that the website's tag links are always SEO-friendly, readable by users, and correctly point to the target page, which has immeasurable value for optimizing website structure and the transmission of internal link weights.
Practice Session: Flexible Use of Tag Information
To better display{% tagDetail %}the actual application, let's take a comprehensive example.Imagine that you are designing a page to display specific industry tags, and you hope that each tag not only has a name but also shows a brief introduction and a clickable link.
<div class="tag-card">
{# 将ID为15的标签所有信息赋值给变量myFeaturedTag #}
{% tagDetail myFeaturedTag with id="15" %}
<h3 class="tag-title">{{ myFeaturedTag.Title }}</h3>
<p class="tag-description">{{ myFeaturedTag.Description }}</p>
<a href="{{ myFeaturedTag.Link }}" class="tag-link">探索更多 {{ myFeaturedTag.Title }} 相关内容</a>
{% endtagDetail %}
</div>
{# 如果您在标签详情页,获取当前标签的所有信息则更简洁 #}
<div class="current-tag-info">
{% tagDetail currentTag %}
<h1>{{ currentTag.Title }}</h1>
<p>{{ currentTag.Description }}</p>
<div class="tag-meta">标签ID: {{ currentTag.Id }} | 首字母: {{ currentTag.FirstLetter }}</div>
{% endtagDetail %}
</div>
In this example, we first use{% tagDetail myFeaturedTag with id="15" %}Load all available information of the tag with ID 15 into a variable namedmyFeaturedTag. This way, we can go throughmyFeaturedTag.Title/myFeaturedTag.DescriptionandmyFeaturedTag.LinkProperties such as auto, are clearly and conveniently displayed on the page. This way of variable assignment makes the code cleaner and improves the readability of the template.
超越基本:其他实用字段速览
ExceptDescriptionandLink,{% tagDetail %}标签还提供了其他多种字段,它们共同构成了标签的完整画像:
Id:标签的唯一标识符。Title:Label display name, such as 'Website Operation'.FirstLetter:The first letter of the label name, often used in alphabetical order of the label list.LogoThe thumbnail or icon address of the label, which can be used for visual presentation.Content:The tab may contain rich text content. If the Markdown editor is enabled, you can also choose whether to render it.
These fields' flexible usage will help you build a powerful, aesthetically pleasing, and SEO-friendly tag system in the AnQi CMS, thus better serving your website operation goals.
Summary
{% tagDetail %}Labels are an indispensable tool in the development of Anqi CMS templates.Through it, you can easily obtain the description information of tags and custom URLs, which has profound significance for refined content operation, optimizing website SEO, and enhancing user experience.Mastering its usage will enable you to soar in the content management and template design of Anqi CMS, bringing your website even greater excellence.
Common Questions (FAQ)
问:Why did the link on the front-end page not change as expected, although I set a custom URL for a certain tag in the background?
答:This is usually due to incorrect configuration of the website's pseudo-static rules or conflicts with custom URLs.Firstly, please make sure that your security CMS rewrite rule is enabled correctly and matches the configuration of your web server (such as Nginx or Apache).Next, the custom URL you set must remain unique throughout the entire site.If the Aanqi CMS detects duplicates, it may automatically add random numbers to the end of the URL to ensure uniqueness, which may not be the link format you expect.建议检查后台的“伪静态规则”设置,并确保您自定义的标签URL是唯一的且符合规则定义。
Q:{% tagDetail %}ofDescriptionWhat is the difference between the field and the "SEO title" and "tag keywords"? What are their respective uses?
Answer: They each serve different SEO purposes:
Description(corresponding to the background's 'Tag Introduction'): mainly used to generate pages<meta name="description">Label content, which is the summary displayed in the search engine results. It should be an attractive and concise text that summarizes the topic of the label page and encourages users to click.- **“SEO