As an experienced website operations expert, I am well aware of the importance of structured data (Json-LD) in modern search engine optimization.It can help search engines understand web content more accurately, thereby improving the display effect of the website in search results.TagInformation into Json-LD, enhancing your content marketing strategy to the next level.

Deeply understand the Tag function of AnQi CMS and the value of Json-LD.

In AnQi CMS,TagTags are an important tool for organizing and categorizing content.It is not only a valid supplement to article classification, but also a key entry for users to quickly search and find related content.By adding precise tags to articles, we can more finely depict the article theme, improve user experience, and provide richer contextual information for search engines, which is greatly beneficial for enhancing the professionalism and user stickiness of the website.

And Json-LD, as a recommended structured data format, its core value lies in its ability to tell search engines about your web content in a standardized language.When we embed the article's Tag information into Json-LD, it is as if we are delivering a precise 'content summary' to the search engine, directly telling it the key theme of the article.This helps to improve the visibility of the article in search results, and even has the opportunity to stand out in rich media search results, bringing more high-quality traffic to the website.

However, to present the carefully managed Tag data from the Anqi CMS backend in a JSON-LD format that conforms to Schema.org standards, this involves some practical tips and strategies.

Get the article Tag information: Using AnQi CMS template tags

To display the Tag of the article in Json-LD, we first need to accurately obtain all the Tags associated with the current article in the article detail page template. AnQi CMS provides a very convenient template tag ——tagList.

tagListTags are used to obtain the Tag list of articles. On the article detail page (usuallydetail.htmlsuch template files), we can usually directly access the current article'sarchiveAn object that contains various details of the article, including itsId. By using the article'sIdpass totagListlabel'sitemIdparameters, we can easily retrieve all the tags related to the article.

For example, in your article detail template, you can use it like thistagListTo get all the tags of the current article:

{% tagList articleTags with itemId=archive.Id %}
    {# 在这里,articleTags变量将包含当前文章的所有Tag对象 #}
{% endtagList %}

Here, articleTagsis an array that contains multiple Tag objects. Each Tag object usually includesId/Title(label name),Link(Tag link) and other fields. The most commonly needed in Json-LD isTitlewhich is the text content of the tag.

Integrate Tag information into Json-LD: Custom Json-LD tag

AnQi CMS providesjsonLdCustom call tag, allowing us to more flexibly control the structured data on the page.The cleverness of this tag lies in the fact that it allows you to define Json-LD content within it, and Anqicms will automatically merge it with the default Json-LD data generated by the system.If your custom field conflicts with the default field, the custom content will take precedence over the default value.

In the Json-LD ofArticleThere is usually one in the (article) SchemakeywordsThe attribute is used to list the key topics of the article. This attribute is very suitable for storing article Tag information, as it accepts an array of strings as its value.

Our strategy is:

  1. First, utilizetagListGet all the tags of the article.
  2. Then, injsonLdthe tag, through a loop to traversearticleTagsto each tag'sTitleExtract and format it into an array in Json-LD format.

This is a complete example of fetching and displaying article Tag to Json-LD in the AnQi CMS article detail page template