As an experienced website operations expert, I am well aware of the powerful potential of AnQi CMS in content management and SEO optimization. Today, we will delve into a very practical template tag in AnQi CMS -{% tagDetail %}It can help us manage and display website tag data more finely, thereby improving user experience and search engine friendliness.
Secure CMS{% tagDetail %}In-depth analysis of tags: Mastering the acquisition and application of tag data
In AnQiCMS, tags (Tag) are an important tool for organizing content, enhancing content relevance, and performing SEO optimization.They can not only help users quickly find topics of interest, but also enable search engines to better understand the content structure of websites.{% tagDetail %}The tag, which is the key to obtaining detailed information of a single tag, allows us to flexibly call the various data of the tag in the template to build rich, dynamic, and SEO-friendly tag pages or related content displays.
{% tagDetail %}The core capabilities and usage methods of the label
{% tagDetail %}The main function of the tag is to obtain all editable field data of the specified tag according to the tag ID or URL alias. Its basic usage syntax is as follows:
{% tagDetail 变量名称 with name="字段名称" id="1" %}
Here,变量名称Is an optional alias, if you define it, you can later refer to the obtained data through this alias;nameThe parameter is the specific field name you want to retrieve. In addition, you can also specifyidthe unique ID of the tag throughtokenThe URL alias of the parameter specified to retrieve data. If not specifiedidortoken, the default tag will try to retrieve the tag data of the current page. In the multi-site management scenario, you can also go throughsiteIdThe parameter specifies from which site to obtain label data.
Let's take a detailed look next.{% tagDetail %}The field data that labels can obtain and their value in practical applications.
1. TagID (Id):标签的唯一标识
IdEach tag is uniquely identified by a number in the database.It is usually not directly displayed to users, but it is very useful in backend logic processing or when it is necessary to reference this tag for more complex data association.
- 获取方式:
{% tagDetail with name="Id" %}
2. Tag标题 (Title):标签的名称
TitleIs the display name of the label, also the label text that users see most frequently on the website front-end. It is the basis for building tag clouds, tag lists, and page titles.
- 获取方式:
{% tagDetail with name="Title" %}
3. Tag link (Link):Pointing to the URL of the tag aggregation page
LinkThis is the URL address of the aggregated page automatically generated by AnQiCMS for this tag.The user will be redirected to this page after clicking the label, displaying all content associated with this label.Using this field correctly helps with the internal link structure and SEO of the website.
- 获取方式:
{% tagDetail with name="Link" %}
4. Tag description (Description):Brief description of the tag
DescriptionProvided a brief overview of the label content. It not only helps users understand the meaning of the label, but also contributes to SEO.meta descriptionThe important source of tags, which can effectively enhance the attractiveness of the tab page in the search engine results page (SERP).
- 获取方式:
{% tagDetail with name="Description" %}
5. Tag index letter (FirstLetter): The first letter of the tag name
FirstLetterIs the first letter of the label title (usually English), often used to sort the label list in alphabetical order, such as in the "A-Z Label Index" feature.
- 获取方式:
{% tagDetail with name="FirstLetter" %}
6. Tag content (ContentEnglish: Label details or introduction
ContentThe field allows you to add more rich and detailed descriptions to tags, such as background knowledge about this topic, related subtopics, etc. It supports Markdown format, and throughrender=trueparameters with|safeFilter, which can render exquisite HTML content on the front end, greatly enhancing the display power of the tab.
- 获取方式:
{% tagDetail tagContent with name="Content" render=true %}{{tagContent|safe}}
7. Tag's Logo (Logo): The picture or icon of the tag
LogoThe field can specify an image or icon for each tag.This is very useful when designing the visual elements of tag clouds, feature tag lists, or tag pages, which can make the page more attractive and identifiable.
- 获取方式:
<img src="{% tagDetail with name="Logo" %}" alt="{% tagDetail with name="Title" %}" />
8. Tag's SEO title (SeoTitle):Custom title for the tab
SeoTitleIt is a custom SEO title for the tag aggregation page, allowing you to optimize for search engines and set a title that is more thanTitleA more descriptive and keyword-rich title to improve the ranking of the tab in search results.
- 获取方式:
{% tagDetail with name="SeoTitle" %}
9. Tag keywords (Keywords): Custom keywords for the tab
KeywordsThe field is used to set the search engine keywords for the label aggregation page. Although modern search engines aremeta keywordsThe weight has decreased, but under specific SEO strategies, it can still serve as auxiliary information to help search engines understand the page theme.
- 获取方式:
{% tagDetail with name="Keywords" %}
Example of practical application scenarios
Understood{% tagDetail %}How can we integrate the data we can obtain into website operations?
- Optimize the SEO information of the tag aggregation page:In
tag/detail.html(or custom tag detail template) usingSeoTitle/KeywordsandDescriptionBuild the page.<title>and<meta>Tags, make sure each tag page has unique and optimized SEO metadata. - Create beautiful and informative tag lists:When displaying popular tags or related tags, it can be combined
Title/LinkevenLogowith fields to generate a list of tags with icons and descriptions, guiding users to discover more content. - to enrich the tag page content:Utilize
ContentFields, provide detailed information about the tab at the top or sidebar of the tab, which can not only improve user experience, but also increase the richness of page content, and is very beneficial for SEO.
In short,{% tagDetail %}The tag provides strong tag data acquisition capabilities for AnQiCMS users, allowing us to manage and display tag information in a more refined and flexible manner.Use these fields well, it will help your website take a new step in content organization, user navigation, and search engine visibility.
Common Questions (FAQ)
1. How to get the list of all tags associated with the current article?To get all tags associated with the current article, you should use{% tagList %}tags instead of{% tagDetail %}.tagListCan iterate and display multiple tags associated with the current document (or other specified document).