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 (AnQiCMS), a tag is not only a content classification tool but also a bridge connecting user interests with the website's content.Today, let's delve into how to utilize{% tagDetail %}This powerful template tag accurately retrieves detailed information about a specific tag, especially its description content and custom URL, thereby better serving the operation and SEO of the website.

Get to know{% tagDetail %}: Tag information retrieval tool

In the template system of Anqi CMS,{% tagDetail %}Tags play a key role in obtaining detailed information about a single tag.It allows you to retrieve rich data for specified tags on any page of the website, whether it is a tag aggregation page, article detail page, or any other custom page.This is crucial for building personalized tag displays, optimizing the SEO elements of the tab page, and achieving more precise internal link strategies.

Its basic usage is very intuitive, you can choose to output a field directly, or assign all the information of the label to a variable for easier reference in the template.

Core feature one: Retrieve tag description information (Description)

Behind each carefully 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 backend, the "label introduction" you fill in when editing the label is exactly that{% tagDetail %}Tags can be used toname="Description"Content obtained by the parameter.

For example, if you want to display the introduction of the tag at the top of the tab page, or use it for the page,meta descriptiontag to improve SEO, 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 crucial for 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.DescriptionCan significantly increase click-through rate, leading more potential users to visit your website.

Core feature two: Master custom URL (Link)

A clear, meaningful URL is the key to website user experience and SEO.In Anqi CMS, you can set a 'custom URL' for each tag, making the link address more friendly and semantically appropriate.{% tagDetail %}label'sname="Link"The parameter 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 for tags in the background (for example/tags/{token}.htmlor/tag/{id}.html)LinkThe field will automatically output the correct, accessible URL of the label. This is very convenient for building tag navigation, breadcrumb navigation, and inserting related label links in articles.

This is an example of calling a 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>

ByLinkField, you can ensure that the website's tag links are always SEO-friendly, user-readable, and correctly point to the target page, which is invaluable for optimizing the website structure and internal link weight transmission.

Practice exercise: Flexibly call label information

To better display{% tagDetail %}In practical application, let's look at a comprehensive example. Imagine that you are designing a page to display specific industry tags, where each tag not only has a name but also shows an 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 label with ID 15 into a variable namedmyFeaturedTag. This way, we can go throughmyFeaturedTag.Title/myFeaturedTag.DescriptionandmyFeaturedTag.LinkProperties, clearly and conveniently displayed on the page. This variable assignment method makes the code cleaner and improves the readability of the template.

Beyond Basics: Overview of Other Useful Fields

exceptDescriptionandLink,{% tagDetail %}Tags also provide a variety of other fields, which together make up the complete profile of a tag:

  • Id: The unique identifier of a tag.
  • Title: The display name of the tag, such as "website operation".
  • FirstLetter: The initial letter of the tag name, often used in alphabetical order lists of tags.
  • Logo: An abbreviation or icon address of the label, which can be used for visual presentation.
  • Content: The tab may contain rich text content, and if the Markdown editor is enabled, you can also choose whether to render it.

The flexible use of these fields will help you build a powerful, beautiful, and SEO-friendly tag system in Anqi CMS, thereby better serving your website operation goals.

Summary

{% tagDetail %}Tags are an indispensable tool in the development of Anqi CMS templates.By it, you can easily obtain the description information of the tag and a custom URL, which has a profound significance for refined content operation, optimizing website SEO, and improving user experience.Mastering its usage will empower you in the content management and template design of Anqicms, bringing an even more outstanding performance to your website.


Frequently Asked Questions (FAQ)

What is the reason that the custom URL I set for a tag in the background did not change as expected on the front page link?

Answer: This is usually due to incorrect configuration of the website's pseudo-static rules or conflicts with custom URLs.First, make sure that your SafeCMS URL rewriting rules are enabled correctly and match your web server configuration (such as Nginx or Apache).Secondly, the custom URL you set must remain unique across the entire site.If Anqi CMS detects a duplicate, it may automatically add random numbers to the end of the URL to ensure uniqueness, which may not be the link format you expect.Suggest checking the "pseudo-static rule" settings on the back-end and ensure that your custom tag URL is unique and conforms to the rule definition.

Question:{% tagDetail %}ofDescriptionWhat is the difference between the 'SEO title' and 'tag keywords' fields in the background? What are their respective uses?

Answer: They each serve different SEO purposes:

  • Description(Corresponds to the background "label introduction"): Mainly used to generate the page's<meta name="description">Tag content, it is the content abstract displayed in the search engine results. It should be a compelling, concise text that summarizes the theme of the tag page and encourages users to click.
  • **“SEO