The `{% tagDetail %}` tag can get which field data of Tag?
As an experienced website operations expert, I deeply understand 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 tags more finely, thereby improving user experience and search engine friendliness.
Security CMS{% tagDetail %}In-depth analysis of tags: Mastering the acquisition and application of tag data
In AnQiCMS, tags 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 the website. And{% tagDetail %}The tag is the key to obtaining detailed information about a single tag, it 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 ability and usage of the tag
{% tagDetail %}The primary function of the label is to retrieve all editable field data of the specified tag based on 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 refer to the obtained data later through this alias;nameThe parameter is the specific field name you want to retrieve. In addition, you can also pass throughidParameter specifies the unique ID of the tag, or pass throughtokenSpecify the URL alias of the parameter to retrieve data. If not specifiedidortoken, the tag will default to trying to retrieve the tag data of the current page. In a multi-site management scenario, you can also usesiteIdThe parameter specifies from which site to obtain tag data.
Let's get to know in detail next.{% tagDetail %}The field data that tags can obtain and their value in practical applications.
1. TagID (Id): Unique Identifier of the Tag
IdIs each tag a unique number identifier in the database. It is usually not displayed directly to users, but it is very useful in backend logic processing or when referencing the tag for more complex data association.
- Method of Acquisition:
{% tagDetail with name="Id" %}
2. Tag Title (Title): Name of the Tag
TitleThe display name of the tag, which is also the text that users most commonly see on the website front end. It is the basis for building tag clouds, tag lists, and tag page titles.
- Method of Acquisition:
{% tagDetail with name="Title" %}
3. Tag link (Link): URL pointing to the tag aggregation page
LinkIs the URL address automatically generated by AnQiCMS for the aggregation page of this tag.When the user clicks on the tag, it will jump to this page and display all the content associated with the tag.Using this field correctly helps with the internal link structure and SEO of the website.
- Method of Acquisition:
{% 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 is also involved in SEO.meta descriptionThe important source of tags, which can effectively enhance the attractiveness of the tag page in the search engine results page (SERP).
- Method of Acquisition:
{% 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), commonly used for alphabetical arrangement of label lists, such as in the "A-Z Label Index" feature.
- Method of Acquisition:
{% tagDetail with name="FirstLetter" %}
6. Tag content (Content): Tag details or introduction
ContentThe field allows you to add more rich and detailed descriptions to tags, such as background knowledge about the topic, related subtopics, etc. It supports Markdown format and is accessed byrender=trueParameters and|safeFilter, can render exquisite HTML content on the front end, greatly enhancing the display of the tab page.
- Method of Acquisition:
{% tagDetail tagContent with name="Content" render=true %}{{tagContent|safe}}
7. Tag's Logo (Logo): Image or icon of the tag
LogoThe field can be used to specify an image or icon for each tag. This is very useful in designing visual elements such as tag clouds, featured tag lists, or tag pages, making the page more attractive and identifiable.
- Method of Acquisition:
<img src="{% tagDetail with name="Logo" %}" alt="{% tagDetail with name="Title" %}" />
8. Tag's SEO title (SeoTitle): Custom title for the tag page
SeoTitleIt is a custom SEO title for the tag aggregation page, it allows you to optimize for search engines, setting a title that is moreTitleA title with more descriptive and keyword density to improve the ranking of the tab in search results.
- Method of Acquisition:
{% 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 formeta keywordsThe weight has decreased, but under specific SEO strategies, it can still serve as auxiliary information to help search engines understand the theme of the page.
- Method of Acquisition:
{% tagDetail with name="Keywords" %}
Example of practical application scenarios
Understood{% tagDetail %}After obtaining which data, how can we integrate them into website operations?
- Optimize the SEO information of the tag aggregation page:In
tag/detail.html(or use a custom tag detail template), usingSeoTitle/KeywordsandDescriptionTo build the page<title>and<meta>Tags, ensure that each tag aggregation page has unique, optimized SEO metadata. - Create a beautiful and informative tag list:When displaying popular or related tags, you can combine
Title/LinkevenLogofields to generate a tag list with icons and descriptions, guiding users to discover more content. - Enrich the tag page content:Utilize
ContentThe field provides a detailed introduction to the label at the top of the tab or in the sidebar, which not only enhances user experience but also increases the richness of page content and is very beneficial for SEO.
In short,{% tagDetail %}Tags provide powerful tag data acquisition capabilities for AnQiCMS users, allowing us to manage and display tag information in a more refined and flexible manner.Using these fields will help your website take a new step in content organization, user navigation, and search engine visibility.
Frequently Asked Questions (FAQ)
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 %}tag instead of{% tagDetail %}.tagListCan iterate and display multiple tags associated with the current document (or other specified document).Example:
“`twig
{% tagList tags with itemId=archive.Id limit=“10” %}