In today's highly competitive online environment, it is the goal of every website operator to make their website content stand out, be accurately understood by search engines, and displayed in an attractive manner.Among them, Json-LD structured data plays a crucial role.AnQiCMS (AnQiCMS) is an efficient and customizable content management system that not only provides powerful content publishing and SEO optimization capabilities, but also allows us to highly customize Json-LD structured data, thereby giving our website more advantages in search engine results pages (SERP).

Structured data: The "language" of search engines

Imagine, a search engine is like a 'reader' in the process of learning.When we publish a regular article, it needs to go through a complex algorithm to understand the title, images, text, author, and other information on the page, and this process may have understanding biases.And structured data, especially Json-LD, is like using a 'standard language' to clearly tell search engines: 'This content is about an article, what is the title, who is the author, when was it published, what are the illustrations.'

In this way, search engines can understand our page content more accurately and quickly, which may allow them to display search results in a richer form, such as star ratings, product prices, article thumbnails, event dates, etc., which is what we commonly refer to as "Rich Snippets" and "Featured Snippets".These rich display forms not only improve user click-through rate, but also make our content stand out visually among numerous search results.

AnQi CMS truly understands this, it is developed based on Go language, with a high-performance architecture, flexible content model, and advanced SEO tools, building a unique platform for us.It supports the function of custom content models, allowing us to define different types of content structures such as articles, products, and activities according to business needs;Static URL and 301 redirection management ensures URL optimization;These built-in Sitemap generation, keyword library management, and other tools lay a solid foundation for the effective application of structured data.

How does AnQi CMS handle structured data?

The Anqi CMS enables the structured data feature in the background, and it usually automatically generates some basic Json-LD structured data for our pages.These default generated data can already meet some basic SEO needs, such as identifying the type of page (article, web page, etc.), title, and links, etc.

However, the actual needs of the website are often diverse. For example, you may want to display more detailed inventory information and user reviews on the product detail page, or highlight specific author information and update dates on the article page.Relying solely on default structured data may not fully meet these refined display requirements.

To give us greater freedom, AnQi CMS provides a very practical template tag:{% jsonLd %}This tag allows us to insert a custom Json-LD code block in the template file.The cleverest part is that we do not need to rewrite all structured data, AnQi CMS will intelligently merge the Json-LD we customize with the default data generated by the system.If a field conflict occurs, our custom content takes precedence over the default value, allowing us to accurately adjust specific fields without worrying about destroying the overall structure.

Practice of custom Json-LD structured data

To customize Json-LD, we mainly operate in the template files of the website. Usually, we would choose tobase.htmlFiles define the universal structured data for the entire site, such as corporate information or website navigation; for specific types of content, such as articles or products, there will be corresponding detail page templates (such asarticle/detail.htmlorproduct/detail.htmlMake more specific customization in the。“

Use{% jsonLd %}The syntax of the tag is very direct, just wrap it in。“<script type="application/ld+json">Outside the tag, then write JSON-LD code that conforms to Schema.org standards.

Let's see how to implement it through several common scenarios.

1. Enhance the article page's Json-LD data

Suppose we want to add more detailed author information and standardized publishing/update time to the article page.

In your article detail page template (for examplearticle/detail.htmlyou can use it like this:

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "{% archiveDetail with name='Title' %}",
  "image": [
    "{% archiveDetail with name='Logo' %}" {# 如果有多图,archiveDetail Images tag可获取数组 #}
   ],
  "datePublished": "{{ stampToDate(archive.CreatedTime, '2006-01-02T15:04:05-07:00') }}",
  "dateModified": "{{ stampToDate(archive.UpdatedTime, '2006-01-02T15:04:05-07:00') }}",
  "author": {
    "@type": "Person",
    "name": "{% archiveDetail with name='author' %}" {# 假设您在内容模型中自定义了“作者”字段 #}
  },
  "publisher": {
    "@type": "Organization",
    "name": "{% system with name='SiteName' %}",
    "logo": {
      "@type": "ImageObject",
      "url": "{% system with name='SiteLogo' %}"
    }
  },
  "description": "{% archiveDetail with name='Description' %|safe}" {# |safe过滤器确保HTML实体正确显示 #}
}
</script>
{% endjsonLd %}

Here, we make use of the powerful template tags of Anqicms, such as{% archiveDetail %}Dynamically retrieve the title, main image, publication and update time, summary, and custom "author" field of the article.{% system %}Labels help us obtain the website name and Logo as publisher information. It should be noted that the date format should follow the ISO 8601 standard,stampToDateTags can facilitate easy format conversion.

2. Enrich the product page's Json-LD data

For product pages, price, inventory, and customer reviews are information favored by search engines.

On your product detail page template (for example){product/detail.html}, you can customize it like this: