The Auto CMS provides a powerful and flexible content management system, where the Tag label is not only an important tool for content classification, but also a key link for refined SEO optimization and improving user experience.Many operators may wish to display unique visual styles or configure exclusive search engine optimization information (TDK) for different Tag tags pages to achieve more accurate marketing goals.Next, we will delve into how to achieve this goal in the security CMS.

Understanding Tag label management in Anq CMS

In the AnQi CMS, Tag labels are not just accessories of article content; they have an independent management interface and configurable properties. Through the "Content Management" -> "Document Tags" module on the backend, you can make detailed settings for each tag, including:

  • Tag name:The label name displayed to users on the front end.
  • Customize URL:Generate a friendly URL path for the label page, which is crucial for SEO.
  • SEO title:Pages designed specifically for search engines, usually more descriptive than tag names.
  • Tag keywords:The core keywords of the tab page, helping search engines understand the page theme.
  • Tag introduction:The Meta Description of the tab page, briefly summarize the content of the page, and attract users to click.

These backend settings are the foundation for implementing personalized Tag page TDK, ensuring that each tag page has its independent SEO configuration.

Set independent display template for specific Tag label

The template system of Anqi CMS is highly flexible, allowing you to specify independent display templates for different types of content (such as articles, categories, single pages). For Tag tags, Anqi CMS provides default templates.tag/index.html(Tag Home Page) andtag/list.html(Tag document list page) as a general template.However, if you want to design a unique display layout for a specific Tag tag, you need to cleverly utilize the conditional judgment of the template and the local template inclusion feature.

Since the security CMS does not provide a field to directly specify a template like categories or single pages in the tag management interface, the strategy to implement "independent display template" is totag/list.htmlThis general template internally, through code logic, determines which Tag is currently accessed and introduces different local template files based on the judgment result.

The specific implementation ideas are as follows:

  1. Prepare local template files:In your theme template directory (for example),/template/your_theme/You can create a subdirectory specifically for Tag tag customization templates, such aspartial/tag_templates/. Here, you can create a template file for a specific Tag, such astag-brandA.html/tag-event.html, and one as a backuptag-default-list.html. These local templates will contain the unique layout and style you want.

  2. Intag/list.htmlPerforming conditional judgment: tag/list.htmlIs the entry point for all Tag document list pages. In this file, you can use:tagDetailGet the detailed information of the current Tag by tag, then according to itsId/TitleorLinkMake conditional judgments on properties and dynamically load locally prepared templates.

    For example, yourtag/list.htmlFiles can be written as follows:

    {% tagDetail currentTag %} {# 获取当前Tag的详细信息 #}
    
    
    {% if currentTag.Title == "品牌A" %}
        {% include "partial/tag_templates/tag-brandA.html" %}
    {% elif currentTag.Id == 123 %} {# 假设TagID为123是"活动专题" #}
        {% include "partial/tag_templates/tag-special-event.html" %}
    {% else %}
        {# 默认的Tag列表显示逻辑,或者引入一个通用的局部模板 #}
        {% include "partial/tag_templates/tag-default-list.html" %}
    {% endif %}
    

    Through this way, when the user visits the page of the 'Brand A' Tag, the system will loadtag-brandA.htmlthe layout defined; when visiting the 'Event Special' Tag, it will loadtag-special-event.html; And other tags that are not specially specified will revert totag-default-list.html.

  3. Call Tag data in local templates:Intag-brandA.html/tag-special-event.htmlIn local templates, you can continue to usetagDataListLabel to get the document list under the Tag and display it according to your design.

Refine the management of the TDK of Tag tags.

For the TDK of Tag tags, Anqi CMS provides a very convenient management and call method.When you set 'SEO title', 'tag keywords', and 'tag introduction' for a Tag in the 'Document Tags' section in the background, the system will intelligently extract the corresponding Tag TDK when calling TDK information in the template.

This means that you do not need to write complex TDK extraction logic for each Tag label page. Simply use the general header template of the website (usuallybase.htmlorpartial/header.html) provided by the Safe CMS.tdkthe tag:

<!DOCTYPE html>
<html lang="{% system with name='Language' %}">
<head>
    <meta charset="UTF-8">
    <title>{% tdk with name="Title" siteName=true %}</title> {# siteName=true 会自动附加网站名称 #}
    <meta name="keywords" content="{% tdk with name="Keywords" %}">
    <meta name="description" content="{% tdk with name="Description" %}">
    {%- tdk canonical with name="CanonicalUrl" %}
    {%- if canonical %}
    <link rel="canonical" href="{{canonical}}" />
    {%- endif %}
    {# 其他CSS、JS等资源引入 #}
</head>
<body>
    {# 页面内容 #}
</body>
</html>

When the user visits any Tag page,<title>/<meta name="keywords">and<meta name="description">Labels will automatically fill in the SEO title, label keywords, and label introduction set for the current Tag in the background.This mechanism greatly simplifies the management of TDK, ensuring the accuracy and independence of SEO information.

Summary

Through the above strategies, you can flexibly customize independent display templates and TDK information for specific Tag tags in the Safe CMS. This not only