Custom Json-LD tags in AnQi CMS: Master the core tool for optimizing structured data

Json-LD (JSON for Linking Data) is a way to embed structured data in web pages using JSON format, which can help search engines better understand page content and possibly display more attractive "rich media summaries" (Rich Snippets), such as articles, products, reviews, and more.For users of the Anqi CMS who pursue the ultimate SEO performance, understanding and mastering the basic syntax structure of custom Json-LD tags is undoubtedly a key step in enhancing website competitiveness.

Management mechanism of Json-LD in AnQi CMS

After enabling the structured data feature in AnQi CMS on the backend, it will automatically generate some basic Json-LD structures for your page, such as for article pages, it may generateArticleorBlogPostingType, could be on the product pageProductType.These built-in structured data can meet most basic needs.However, when facing specific business scenarios, more complex entity relationships, or more refined marketing strategies, we often need to supplement or modify these default data.

The core syntax structure of the custom Json-LD tag

In AnQiCMS, the basic syntax structure of custom Json-LD tags is concise and intuitive, it adopts a unique block-level tag form, allowing you to embed standard JSON-LD scripts within it. Its core structure is as follows:

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "name": "您的安企CMS网站名称",
  "url": "https://www.yourdomain.com/"
}
</script>
{% endjsonLd %}

As you can see, the entire custom Json-LD code is enclosed in{% jsonLd %}and{% endjsonLd %}these tags. And within this pair of tags, you need to nest a standard HTML structure,<script type="application/ld+json">Label, and write structured data content that conforms to the JSON-LD syntax within this script tag.

For example, if you want to add a basicWebSiteStructured data of a (website) type, the above example code shows its basic structure.@contextSpecifies the Schema.org vocabulary,@typeDefines entity types,nameandurlThe website's basic information is provided.

Understand the intelligent merging mechanism of AnQiCMS in depth.

It is noteworthy that Anq CMS does not simply replace custom Json-LD data, but rather employs an intelligent 'merge' mechanism. This means that when you use{% jsonLd %}When labeling structured data, AnQiCMS will merge it with the Json-LD data generated by the system by default. The rules for merging follow the following principles:

  1. New Field:If you customize your JSON-LD and it includes fields that are not predefined by the system, these fields will be appended to the final Json-LD output.
  2. Field Override:If your custom JSON-LD contains key-value pairs with the same names as the system default fields, your custom values will take precedence and override the system default values.

This merging mechanism provides you with great flexibility. You don't have to worry about rewriting all the Json-LD content, just focus on the specific parts you want to add or modify.

For example, assuming that AnQi CMS defaults to generating a page for your article that includesheadline(Title) anddatePublished(Publish date) ofArticle(Article) Type Json-LD. If you want to add additional information for this articleauthorauthor information and a customimage(Image) List, and it may be necessary to override the default image, you can write it like this:

{% jsonLd %}
<script type="application/ld+json">
{
  "author": {
    "@type": "Person",
    "name": "AnQiCMS 编辑团队"
  },
  "image": [
    "https://en.anqicms.com/uploads/2023/custom-image-1.jpg",
    "https://en.anqicms.com/uploads/2023/custom-image-2.jpg"
  ]
}
</script>
{% endjsonLd %}

When the page is rendered, the final Json-LD output will contain the system defaultheadlineanddatePublishedand it will also include your customizedauthorobjects andimagearrays. If the system also generates theimagefield, then your customizedimagearray will override the default value.

Points to note in practice

  1. Json-LD syntax verification:JSON-LD has strict requirements for syntax structure, any minor error can cause structured data to be incorrectly parsed by search engines.Before deploying custom Json-LD, it is strongly recommended that you use Google's "Rich Media Search Results Test" tool to verify the correctness and validity of the syntax.

  2. Background feature enabled:Make sure your AnQiCMS backend has enabled the structured data related features.Although custom tags allow you to directly insert Json-LD, the structured data toggle at the system level may affect the final rendering and recognition.

  3. **Template insertion position: