As an experienced website operation expert, I fully understand that in the era of 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 for achieving our 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 SEO-friendly design, provides us with an excellent platform to achieve these advanced optimizations.Today, let's delve into how to flexibly add or expand the Json-LD structured data in the AnQiCMS custom content model.
The AnQi CMS custom content model: Deeply unlock the power of Json-LD structured data
In the vast sea of information on the Internet, it is the core strategy to enable our website content to be accurately understood by search engines and presented in a more attractive way, thus improving website traffic and conversion rates.Json-LD (JSON for Linking Data) is a lightweight data format that plays the role of a 'search engine translator', describing entities and their attributes on web pages in a machine-readable way to search engines like Google and Baidu, such as an article's author, publication date, reviews, a product's price, inventory, brand, etc.
AnQiCMS (AnQi CMS) was born to meet this kind of demand.It has highly flexible custom content model features, allowing us to create various types of content such as articles, products, events, and more according to business characteristics.What is even better is that AnQiCMS is built with 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 'semanticization' capabilities and winning the favor of search engines.
The value of Json-LD: Why is it indispensable?
In simple terms, Json-LD can help our content gain "privileges" on search engine results pages (SERP).Imagine a scenario where, when a user searches for a product on your website, it not only displays a simple 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, allowing your website to stand out in competition.
How AnQiCMS can work with Json-LD?
The strength of AnQiCMS lies in the flexibility of its 'content model'.No matter what you create is 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 for building rich Json-LD structured data.
At the same time, the AnQiCMS template engine (similar to Django template syntax) provides powerful data call capabilities.We can easily retrieve the content data of the current page using various built-in tags, including article title, description, image, price, and the values of all custom fields.and AnQiCMS has provided a special and extremely convenient one for it{% jsonLd %}The tag allows us to directly insert Json-LD code blocks in the template and intelligently merge them with the Json-LD data that the system may generate by default, ensuring that the final Json-LD is both complete and meets our customized requirements.
Core step: Add Json-LD for custom content model
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 kind of entity our custom content model represents and find the corresponding structured data type on Schema.org. For example:
- Article model (default of AnQiCMS)
archivetype): usually corresponds toArticle/NewsArticle/BlogPostingand other Schema types. - Product model (default of AnQiCMS)
producttype)Corresponding toProductType, can be nestedOffer/AggregateRatingetc. - Custom 'service' model: May correspond
ServiceType. - Custom 'talent recruitment' model: May correspond
JobPostingType.
Choosing the correct Schema type is fundamental, it tells the search engine what your content is actually about.
Second step: Prepare the required data fields in the content model.
Once the Schema type is determined, we need to check whether our custom content model includes all the data required by Json-LD.AnQiCMS under the "Content Management" section, the "Content Model" feature allows us to add "custom fields" to each model.For example, if your 'product' model needs to include Json-LD in thebrand(Brand) andsku(Stock unit), but by default, there are no such fields, you can add them in the product model:
- Parameter Name: Brand,Field invocation:
brand,Field type: Single-line text, - Parameter Name: SKU,Field invocation:
sku,Field type: Single-line text,
These fields can be filled in when content is published and can be called through tags or directly in the template.archiveDetailor directly usingarchive.FieldNamein the form (if the field is directly mapped) to call it.
Step 3: Edit the template file and insert Json-LD code
This is the key step to turn theory into practice. We need to find the template file corresponding to the custom content model detail page. According to the template directory convention of AnQiCMS, it is usually located intemplate/你的模板目录/{模型table}/detail.htmlFor example, if it is an article detail page, it might betemplate/default/article/detail.htmlIf 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, but it is usually recommended to be in the<head>)Insert your Json-LD code. AnQiCMS provides a special{% jsonLd %}tag, it will process automatically<script type="application/ld+json">The packaging of labels, and intelligently merging with the Json-LD data that the system may generate by default. This means that you only need to in{% jsonLd %}Write the JSON structure you want to add or overwrite inside the tag.
Let's take aProduct modelJson-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 field:
BrandName(Brand Name),ProductSKU(Product SKU)
You can add Json-LD in the product details page template (for example),template/default/product/detail.html):
”`twig {% Ld %}