Structured data: the 'language' of search engines
Imagine, a search engine as a reader who is learning.When we publish a regular article, it needs to go through complex algorithms to understand the page title, images, text, author, and other information, and this process may have understanding biases.While structured data, especially Json-LD, is like us telling search engines clearly in a 'standard language': 'This content is about an article, what is the title, who is the author, what is the publish time, and what are the images accompanying it.'
This way, search engines can more accurately and quickly understand our page content, which may then be displayed in search results in richer formats, such as star ratings, product prices, article thumbnails, event dates, etc. This is what we commonly refer to as 'Rich Snippets' and 'Featured Snippets'.These rich display forms not only enhance user click-through rate, but also make our content stand out visually among numerous search results.
AnQi CMS fully understands this point, it is developed based on the 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 events according to business needs; the management of pseudo-statics and 301 redirects ensures URL optimization; and tools such as built-in Sitemap generation and keyword library management lay a solid foundation for the effective application of structured data.
How does Anqi CMS handle structured data?
After the structured data feature is enabled in the background of Anqi CMS, it usually automatically generates some basic Json-LD structured data for our pages.These default-generated data can already meet some basic SEO requirements, such as identifying the type of page (article, web page, etc.), title, and links.
However, the actual needs of the website are often varied.For example, you may wish 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.May not fully meet these refined display needs solely relying on the default structured data.
To give us greater freedom, Anqi CMS provides a very practical template tag:{% jsonLd %}.This tag allows us to insert custom Json-LD code blocks in template files.The most clever aspect is that we do not need to rewrite all structured data. Anqi CMS will intelligently merge our custom Json-LD with the default data generated by the system.If there is a field conflict, our custom content will take precedence over the default value, which allows us to accurately adjust specific fields without worrying about destroying the overall structure.
The practice of customizing Json-LD structured data
To customize Json-LD, we mainly operate in the template files of the website. Usually, we would choose tobase.htmlDefine structured data for the entire site in the file, such as enterprise 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.htmlCustomize more specifically within 【en】the brackets.
Use{% jsonLd %}The syntax of the tag is very direct, it just needs to be enclosed in 【en】brackets.<script type="application/ld+json">Outside the tag, write JSON-LD code that conforms to Schema.org standards.
Let's look at how to implement this through several common scenarios.
1. Enhance the Json-LD data on the article page
Suppose we want to add more detailed author information and standardized publishing/update times for the article page.
In your article detail page template (for example),article/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 the Anqi CMS,{% archiveDetail %}Retrieve the title, main image, publish and update time, summary, as well as the customized "author" field dynamically.{% system %}Labels help us obtain the website name and Logo as publisher information. It is important to note that the date format should follow the ISO 8601 standard.stampToDateTags can facilitate format conversion.
2. Enrich the Json-LD data on the product page.
For product pages, price, inventory, and user reviews are highly favored information by search engines.
In your product details page template (such as)product/detail.html), you can customize it like this: