As an experienced website operation expert, I fully understand that in the era where content is king, how to make our high-quality content stand out in search engines is particularly important.Structured data, especially Json-LD, is one of the key tools we use to achieve this goal.It can help search engines better understand our web page content, thereby improving the display effect in search results, which is what we often call "Rich Media Search Results (Rich Snippets)".

AnQiCMS as an enterprise-level content management system developed based on the Go language, with its flexible content model and friendly design for SEO, provides us with an excellent platform to implement these advanced optimizations.Today, let's delve into how to flexibly add or expand Json-LD structured data in AnQiCMS's custom content model.


English CMS Custom Content Model: Deeply Unlock the Power of Json-LD Structured Data

In the massive amount of pan-information on the Internet, it is the core strategy to ensure that our website content is accurately understood by search engines and presented in a more attractive manner, which is essential for increasing website traffic and conversion rates.Json-LD (JSON for Linking Data) is a lightweight structured data format that plays the role of a 'translator' for search engines. It describes entities and their properties on web pages in a machine-readable way to search engines like Google, Baidu, etc., such as an article's author, publication date, reviews, a product's price, inventory, brand, and more.

AnQiCMS (English) is created to meet this demand.It allows us to create various types of content such as articles, products, events, and more with its highly flexible custom content model features.Even better is that AnQiCMS has built-in support for structured data and provides a powerful template mechanism, allowing us to easily integrate Json-LD into these custom content models, thereby giving our content stronger 'semantic' capabilities and winning the favor of search engines.

The Value of Json-LD: Why It's Indispensable?

In simple terms, Json-LD can help our content gain 'privileges' on search engine results pages (SERP).Imagine when a user searches for a product, your website not only displays a standard title and description, but also directly shows the product's star rating, price, stock status, and even a thumbnail image.This is the rich media search results brought by Json-LD, which significantly improves the visibility and click-through rate of the content, making your website stand out in the competition.

How does AnQiCMS work with Json-LD?

The strength of AnQiCMS lies in the flexibility of its 'content model'.No matter what you create, whether it's an 'article model', 'product model', 'event model', or 'download model', the system allows you to add any number of custom fields to these models to accurately capture every detail of the content.These custom fields are the foundation of our building rich JSON-LD structured data.

At the same time, AnQiCMS's template engine (similar to Django template syntax) provides powerful data calling capabilities.We can easily obtain the content data of the current page, including article title, description, images, price, and values of all custom fields, through various built-in tags.{% jsonLd %}标签,它允许我们在模板中直接插入Json-LD代码块,并且智能地与系统可能默认生成的Json-LD数据进行合并处理,确保最终输出的Json-LD既完整又符合我们自定义的需求。

核心步骤:为自定义内容模型添加Json-LD (English)

Now, let's learn step by step how to add or extend Json-LD in the custom content model of AnQiCMS.

Step 1: Identify your content model and required Schema type

Before we get started, we need to clarify what type of entity our custom content model represents and find the corresponding structured data type on Schema.org. For example:

  • 文章模型(AnQiCMS默认的 English)archive类型 English:通常对应 EnglishArticle/NewsArticle/BlogPosting等Schema类型 English
  • 产品模型(AnQiCMS默认的 Englishproduct类型 English:Corresponds toProductType, can be nestedOffer/AggregateRatingetc.
  • Custom 'Service' model:May correspond toServicetype.
  • Custom 'Talent Recruitment' model:May correspond toJobPostingtype.

Choosing the correct Schema type is basic, it tells the search engine what your content is actually about.

Step two: Prepare the required data fields in the content model

Once the Schema type is determined, we need to check if our custom content model includes all the data required by Json-LD.AnQiCMS in the 'Content Management' under the 'Content Model' feature, allows us to add 'Custom Fields' for each model.brand(Brand) andsku(Inventory unit), but if there are no these fields by default, you can add them in the product model:

  • Parameter name: Brand,Call field:brand,field type: Single-line text
  • Parameter name: SKU,Call field:sku,field type: Single-line text

These fields can be filled in with corresponding data when content is published, and are called in the template.archiveDetailusing tags or directly.archive.FieldName(if the field is directly mapped) in the form.

Third step: Edit the template file and insert Json-LD code

This is a critical step in turning theory into practice. We need to find the template file corresponding to the custom content model detail page. According to the template directory conventions of AnQiCMS, it is usually locatedtemplate/你的模板目录/{模型table}/detail.html。For example, if it is an article detail page, it might betemplate/default/article/detail.html;if it is a product detail page, it might betemplate/default/product/detail.html.

Open this template file, in the HTML's<head>area (or<body>tag within, but usually it is recommended to be in<head>)Insert your Json-LD code. AnQiCMS provides a special{% jsonLd %}tag, it will handle automatically<script type="application/ld+json">The packaging of the label, and intelligently merging with the Json-LD data that the system may default to generate. This means, you only need to in{% jsonLd %}Label the internal structure you want to add or overwrite.

Let's take oneProduct modelA Json-LD example to illustrate:

Assuming your product model has the following fields:

  • Built-in field:Title(Product Name),Description(Description),Logo(Main Image),Link(Page Link),Price(Price)
  • Custom fields:BrandName(Brand Name),ProductSKU(Product SKU)

You can add Json-LD in the product detail page template (for example)template/default/product/detail.html) like this:

`twig {% Ld %}