In website content management, tags (Tag) play a multiple role in connecting content, optimizing user experience, and improving search engine visibility.A well-managed tagging system can not only help visitors quickly locate the information they are interested in, but also convey the structured information of the website content to search engines, thereby effectively improving SEO effects.tagDetailLabel, allowing you to flexibly retrieve and display detailed information of a single label.
tagDetailLabel: Dive deeper into each of your labels.
tagDetailTags are a core component of the AnQiCMS template system, specifically designed to retrieve all related data for a specific tag. Whether you want to add a brief description for each tag on the tag index page or fully display the name, image, detailed content, and associated articles of a specific tag on an independent tag detail page,tagDetailIt can provide the required data support. Its design philosophy aims to simplify template development, allowing you to implement rich and dynamic tag display functions with the least amount of code.
How to accurately obtain label information? Understand core parameters
UsetagDetailWhen labeling, you can use several key parameters to accurately control the label data you want to obtain:
Specify the label by ID (
id):If you know the unique numeric ID of the target tag, you can directly passid="123"This form is used to accurately obtain its information.This is useful when referencing specific known tags, such as recommending a tag at the bottom of an article or calling a preset tag in a specific module.Specify the tag by URL alias (
token):On the tag detail page, the URL of the page usually contains the URL alias of the tag (i.e.,tokenIn this case,tagDetailTags will intelligently automatically identify the tag information on the current page, you usually do not need to specify manuallyidortokenBut if you need to get tag information based on dynamic URL aliases on other pages, you can also specify throughtoken="your-tag-alias"to specify.Cross-site data call (
siteId):For those who manage multiple sites on AnQiCMS,siteIdThe parameter provides the ability to call cross-site data. If you need to display tag data from other sites in the current site's template, you just need tositeId="X"(Where X is the ID of the target site) can be specified. If your AnQiCMS only manages one site, this parameter is usually omitted.
RevelationtagDetailAttributes available for the tag
BytagDetailThe tag object obtained contains a series of practical properties. You can use these properties to build various and rich tag display effects in the template:
Tag ID (
Id)The unique number identifier of the tag in the system.<div>标签ID:{% tagDetail with name="Id" %}</div>Label title (
Title)The display name of the tag, which is also the main text content that users see on the front-end page.<h1>标签名称:{% tagDetail with name="Title" %}</h1>Label link (
Link): The URL address of the tag detail page. It is the key to building clickable tag navigation, breadcrumb navigation, or related links.<a href="{% tagDetail with name="Link" %}">了解更多关于 {% tagDetail with name="Title" %}</a>Tag description (
Description)This is a brief description of the label content. This attribute is usually used for the Meta Description on the label detail page, which is crucial for search engine optimization (SEO).<p>简介:{% tagDetail with name="Description" %}</p>Label index letter (
FirstLetter): The first letter of the tag name. It is very useful in scenarios where tag lists need to be sorted in alphabetical order.<span>首字母:{% tagDetail with name="FirstLetter" %}</span>Tag category ID (
CategoryId): If the tag is associated with a content category, this attribute will display the ID of the category it belongs to. You can combinecategoryDetailthe tag to get more information about the category.{% set currentTagCategoryId = tagDetail with name="CategoryId" %} {% if currentTagCategoryId %} <p>所属分类:{% categoryDetail with name="Title" id=currentTagCategoryId %}</p> {% endif %}Tag content (
Content): Detailed information about the tag or