When building and optimizing a website, we always hope to enable search engines to better understand the content of our pages, so that they can have better display effects in search results.Structured data, especially structured data presented in JSON-LD format, is an important tool to achieve this goal.AutoCMS (AutoCMS) is a content management system that focuses on SEO optimization, providing flexible and powerful support for inserting custom JSON-LD.

Understand the advantages of structured data and security CMS

The search engine retrieves web content through crawlers, but text and images alone cannot fully convey the 'meaning' of the content.For example, an article about 'AnQiCMS feature introduction' is clear to humans, but to search engines, it may just be a piece of text.If we can clearly tell the search engine that this is an article about software products, titled 'AnQiCMS Feature Introduction', authored by someone, published on a certain date, with core features including content model and SEO tools ..., then the search engine can better understand and may display it in the form of 'Rich Media Search Results' (Rich Snippets), such as with star ratings, images, publication dates, etc., which will undoubtedly greatly increase the click-through rate of the page.

Auto CMS provides many out-of-the-box features in terms of SEO, such as pseudo-static, Sitemap generation, keyword library management, and TDK (title, description, keywords) customization.These are the basics of website SEO, while JSON-LD structured data is an advanced optimization on this basis, which can enhance the search engine's understanding of content from 'reading' to 'comprehension', thereby obtaining more accurate display.

jsonLdThe core function of the tag

In AnQi CMS, the system usually inserts some basic structured data into the page by default to facilitate users. However, if we want to control or supplement these data more finely according to the needs of a specific page, we need to use the AnQi CMS providedjsonLdLabel.

jsonLdThe usage of labels is very intuitive, it adopts{% jsonLd %} ... {% endjsonLd %}such a structure.Its core function is to allow us to insert or modify structured data in the page in pure JSON-LD format.The most commendable thing is that this tag is not simply replaced, but is "merged" with the structured data built into the CMS.This means that we do not need to rewrite the entire JSON-LD object, we just need to provide the fields that we want to customize or supplement.If the custom field conflicts with the system-generated field, the content we manually set will be given priority, which provides great convenience for in-depth customization.

How to build custom JSON-LD

The key to building custom JSON-LD is two: first, be familiar with the Schema.org specification and know which attributes should be included for different types of content; second, how to obtain dynamic data from the template tags of the security CMS and fill it into the JSON-LD.

The template tag system of Anqi CMS is very complete, and we can easily obtain all kinds of information from the page, such as:

  • Page TDK tag (tdk):Get the title, keywords, and description of the current page.
  • System Settings Label (system):Get the global settings such as the site name, Logo, and filing information.
  • Document detail tag (archiveDetail):Get the title, content, images, publish/update time, custom fields, and more of the article or product.
  • Category details label (categoryDetail):Get the name, description, images, and more of the category.
  • Breadcrumbs tag (breadcrumb):Get the page navigation path.

With these data sources, we can flexibly build JSON-LD that conforms to Schema.org specifications.

For example, let's take the article detail page as an example, assuming we want to optimize the structured data of the article:

We can place the following code snippet in the template of the article detail page (for example{模型table}/detail.html) of<head>in the area:

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "{% archiveDetail with name='Title' %}",
  "image": [
    "{% archiveDetail with name='Logo' %}"
  ],
  "datePublished": "{{ stampToDate(archive.CreatedTime, '2006-01-02T15:04:05Z07:00') }}",
  "dateModified": "{{ stampToDate(archive.UpdatedTime, '2006-01-02T15:04:05Z07:00') }}",
  "author": {
    "@type": "Person",
    "name": "这里可以填写文章作者名,也可以动态获取"
  },
  "publisher": {
    "@type": "Organization",
    "name": "{% system with name='SiteName' %}",
    "logo": {
      "@type": "ImageObject",
      "url": "{% system with name='SiteLogo' %}"
    }
  },
  "description": "{% archiveDetail with name='Description' %}"
}
</script>
{% endjsonLd %}

Through the above code, we defined the article's title, main image, publish/modify time, author, publisher, and description. Among them,{% archiveDetail %}/{% system %}andstampToDateThe functions directly utilize the data configured in the Anqi CMS backend, avoiding hardcoding and redundant work.

If we also want to add structured data for the breadcrumb navigation on the page:

Although AnQiCMS has built-in breadcrumb tags, if you want to provide them to search engines in JSON-LD format, we can do it like this:

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {% breadcrumb crumbs %}
    {% for item in crumbs %}
    {
      "@type": "ListItem",
      "position": {{ forloop.Counter }},
      "name": "{{ item.Name }}",
      "item": "{{ item.Link }}"
    }{% if not forloop.Last %},{% endif %}
    {% endfor %}
    {% endbreadcrumb %}
  ]
}
</script>
{% endjsonLd %}

Here, we cleverly utilize{% breadcrumb crumbs %}breadcrumb data traversed by tags to dynamically generateBreadcrumbListstructured data of types.

the benefits of enhancing the display effect of search engines

PassjsonLdLabel insertion of customized structured data, our website will gain many benefits:

  • Enhance rich media search results:Search engines may display more rich search results on our pages, such as article thumbnails, publication dates, product prices, and star ratings, all of which can attract users visually and improve click-through rates.
  • Enhanced content understanding:Structured data clearly defines the entities and relationships of page content, helping search engines better understand the context of page content, thereby more accurately displaying our pages when users search for related information.
  • Potential ranking improvementAlthough structured data itself is not a direct ranking factor, it can improve the visibility, click-through rate, and user experience of the page. These indirect factors all help the website perform better in search results.

In short, the Anqi CMS isjsonLdTags provide a simple yet powerful way to control the structured data of a website.By making reasonable use of this feature, combined with the Schema.org specification, we can make the website content stand out in search engines and attract more target audiences.


Common Questions (FAQ)

1. I amjsonLdDoes the custom content in the label override the structured data generated by the default Safe CMS?Yes,jsonLd