How to use `Json-LD` tags to customize structured data for optimizing the rich text summary display of search engines?

Calendar 👁️ 87

When a search engine displays search results, in addition to simple titles and descriptions, it may also show images, ratings, prices, authors, and other rich information, which is called 'Rich Snippets'.These eye-catching summaries can effectively enhance the visibility of the website in search results, attract more clicks, and thus bring more high-quality traffic to the website.

To obtain these rich text summaries in search engines, we need to provide search engines with a standardized data format that they can understand, which is called "structured data".Among many structured data formats, Json-LD (JSON for Linking Data) is an official recommendation by Google.It is embedded in the HTML document in JSON format, without affecting the display of the page content, and can clearly describe the key information on the page to search engines.

The Anqi CMS is a content management system that highly values SEO optimization and fully considers the application of structured data. It has made many SEO-friendly designs at the system level and also provides a flexible way for users to customize and optimize structured data, where it usesJson-LDTags are an efficient and powerful method.

AnQi CMS supports Json-LD and customization mechanisms.

AnQi CMS knows the importance of structured data, and therefore integrates support for Json-LD in its template system.On the front-end page of the website, you may find that the system has automatically generated some basic Json-LD structured data.But this is not all of its capabilities.{% jsonLd %}The custom call label, allowing us to control the structured data on the page more finely and accurately.

The cleverness of this tag lies in its 'auto-merge and override mechanism'. When you use it in the template,{% jsonLd %}When a tag provides its own Json-LD code, Anqiy CMS will intelligently merge the customized parts with the system default generated Json-LD data.If your custom code contains fields that are the same as the system default data, then your custom content will be displayed first, thus covering the default data.This means you do not need to rewrite or worry about conflicts with the system default settings, just supplement or modify the specific data points you are concerned about.

Practical application ofJson-LDtag custom structured data

Now, let's take a specific look at how to use it in the Anqi CMS template.{% jsonLd %}Tags to achieve optimized rich text abstract display.

While usingJson-LDBefore the label, you need to clarify the content type of the current page, such as whether it is a news article, a product detail page, an FAQ page, or a general web page.Article/Product/FAQPage/WebPageChoose the correct type is the first step in building effective structured data.

Next, we need to be in the Anqi CMS template files, such as the article detail page.{模型table}/detail.htmlOr find the appropriate location to insert in the custom page template{% jsonLd %}Tags. Typically, these Json-LD codes are placed in<head>tags or<body>The beginning of the tag, but for convenience, you can also place them at any position in the page content, and the search engine can still correctly parse them.

We take a typical 'article detail page' as an example, assuming you want to add to the articleArticleStructured data type to display article title, image, publication date, author, and description information. You can write code like this:

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "{% tdk with name='Title' %}",
  "image": [
    "{% archiveDetail with name='Logo' %}"
  ],
  "datePublished": "{{ stampToDate(archive.CreatedTime, '2006-01-02T15:04:05+08:00') }}",
  "dateModified": "{{ stampToDate(archive.UpdatedTime, '2006-01-02T15:04:05+08:00') }}",
  "author": {
    "@type": "Person",
    "name": "安企CMS官方团队" {# 这里可以替换为具体的作者字段或自定义文本 #}
  },
  "publisher": {
    "@type": "Organization",
    "name": "{% system with name='SiteName' %}",
    "logo": {
      "@type": "ImageObject",
      "url": "{% system with name='SiteLogo' %}"
    }
  },
  "description": "{% tdk with name='Description' %}"
}
</script>
{% endjsonLd %}

In this code block:

  • We first defined@contextand@typeIndicates that this is a Schema.org'sArticleType.
  • headline(Article Title),description(Article description) Directly used the TDK tag built into Anqi CMS to obtain, which ensures consistency between data and page SEO settings.
  • image(Article main image) andLogo(Website Logo) usedarchiveDetailandsystemtag to get the image URL. If the article has multiple images, you canimageadd more URLs in the array.
  • datePublished(Publish date) anddateModified(Modify date) Passedarchive.CreatedTimeandarchive.UpdatedTimeGet timestamp and use itstampToDateFormat it into a time string in ISO 8601 standard, which is a requirement for Json-LD date format.
  • authorandpublisher(Publisher information) fills in the article author and website name/Logo, this information can also be obtained from the system settings of AnqiCMS.

Assume you have a product detail page and want to display product price, inventory information, and also want to add custom user reviews (even if the review content itself is not in the default Json-LD).

Related articles

How to retrieve and display the list of all related documents under the Tag detail page?

In content operation, tags (Tag) are an extremely important tool that can help us effectively organize content, improve the quality of internal links on the website, and ultimately improve the user's browsing experience and the search engine's crawling efficiency.By tagging articles, products, or other content with relevant tags, we can associate content with the same theme scattered across different categories, forming a closer knowledge network.

2025-11-08

In the display of the `Content` field of the article, how can I manually control the rendering conversion from Markdown to HTML?

When managing website content in AnQi CMS, we often use Markdown's concise and efficient features to write articles.However, ensuring that this Markdown-formatted content is rendered correctly into attractive HTML on the front-end page can sometimes be a focus for operators.This article will delve into how Anqi CMS handles the Markdown content of the `Content` field of the article, and guide you on how to manually control this rendering conversion process in the template.

2025-11-08

How to truncate a long text content while displaying and automatically add an ellipsis?

In website operation, we often need to display various text content on the page, such as the abstract of article lists, the preview of product introductions, or a brief description of a detailed page.Faced with long-form content, how can one elegantly present the core information within limited space, and guide users to click for more details, is a common need.It is particularly important to truncate long text content and automatically add an ellipsis.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that fully considers this user demand

2025-11-08

How to implement complex conditional judgment and content iteration display in templates using `if/else` and `for` loop tags?

AnQi CMS as an efficient and flexible content management system, its template design capability is the key to building a rich and varied website content.During the template creation process, flexibly using conditional judgment (`if/else`) and content iteration (`for` loop`) tags can help us achieve a more intelligent and dynamic content display, allowing the web page to present personalized layouts and information according to different situations.

2025-11-08

How to call and display specific content or system configuration information from other sites in a multi-site management mode?

AnQiCMS's powerful multi-site management feature brings great convenience to users with multiple brands or sub-sites.It can not only help you manage different content sites uniformly, but also supports cross-site data sharing and resource integration.When you want to display content from other sites on a site, or call the system configuration information of other sites, AnQiCMS provides a simple and efficient mechanism to achieve this goal.In AnQiCMS, the core of implementing cross-site content or configuration information calls lies in the flexible use of template tags such as `siteId`

2025-11-08

How to remove leading and trailing spaces or specific characters from a string in the template using a filter?

In website content display, we often encounter situations where there are extra spaces, line breaks at the beginning and end of strings, or specific characters need to be deleted.These seemingly minor details can affect the layout and aesthetic of the page, the accuracy of data display, and even have an adverse effect on search engine optimization (SEO).AnQiCMS is a powerful template engine that provides rich filter functions, which can help us easily and elegantly handle these strings, making your content more accurate and professional.AnQiCMS's template syntax is concise and intuitive, it draws on Django

2025-11-08

How to perform arithmetic operations such as addition, subtraction, multiplication, and division in the template and display the result?

In AnQiCMS template design, sometimes we need to perform arithmetic operations such as addition, subtraction, multiplication, and division on the numbers displayed on the page to present data more flexibly.Whether it is to calculate the total price of goods, display dynamic percentages, or perform simple processing of certain statistical data, AnQiCMS's template engine provides intuitive and powerful arithmetic calculation capabilities.AnQiCMS's template engine borrows the syntax style similar to Django templates, allowing us to directly output variables in template files (using `{{

2025-11-08

How to customize and display a friendly shutdown notice when the website is in a closed state?

In website operation, we sometimes need to temporarily close the website, whether it is for system upgrades, data maintenance, or short-term business adjustments.It is crucial to display a friendly shutdown prompt to visitors in this case.This not only informs users of the website status, avoids unnecessary confusion, but also maintains the brand image and provides clear guidance for search engines.AnQiCMS (AnQiCMS) provides us with a flexible way to customize and display this information.### Enable website shutdown status and set basic prompts First, you need to set the website to shutdown status

2025-11-08