When a search engine displays search results, in addition to simple titles and descriptions, it may also show images, ratings, prices, authors, and other rich information, which is called 'Rich Snippets'.These eye-catching summaries can effectively enhance the visibility of the website in search results, attract more clicks, and thus bring more high-quality traffic to the website.
The Anqi CMS is a content management system that highly values SEO optimization and fully considers the application of structured data. It has made many SEO-friendly designs at the system level and also provides a flexible way for users to customize and optimize structured data, where it usesJson-LDTags are an efficient and powerful method.
AnQi CMS supports Json-LD and customization mechanisms.
AnQi CMS knows the importance of structured data, and therefore integrates support for Json-LD in its template system.On the front-end page of the website, you may find that the system has automatically generated some basic Json-LD structured data.But this is not all of its capabilities.{% jsonLd %}The custom call label, allowing us to control the structured data on the page more finely and accurately.
The cleverness of this tag lies in its 'auto-merge and override mechanism'. When you use it in the template,{% jsonLd %}When a tag provides its own Json-LD code, Anqiy CMS will intelligently merge the customized parts with the system default generated Json-LD data.If your custom code contains fields that are the same as the system default data, then your custom content will be displayed first, thus covering the default data.This means you do not need to rewrite or worry about conflicts with the system default settings, just supplement or modify the specific data points you are concerned about.
Practical application ofJson-LDtag custom structured data
Now, let's take a specific look at how to use it in the Anqi CMS template.{% jsonLd %}Tags to achieve optimized rich text abstract display.
While usingJson-LDBefore the label, you need to clarify the content type of the current page, such as whether it is a news article, a product detail page, an FAQ page, or a general web page.Article/Product/FAQPage/WebPageChoose the correct type is the first step in building effective structured data.
Next, we need to be in the Anqi CMS template files, such as the article detail page.{模型table}/detail.htmlOr find the appropriate location to insert in the custom page template{% jsonLd %}Tags. Typically, these Json-LD codes are placed in<head>tags or<body>The beginning of the tag, but for convenience, you can also place them at any position in the page content, and the search engine can still correctly parse them.
We take a typical 'article detail page' as an example, assuming you want to add to the articleArticleStructured data type to display article title, image, publication date, author, and description information. You can write code like this:
{% jsonLd %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "{% tdk with name='Title' %}",
"image": [
"{% archiveDetail with name='Logo' %}"
],
"datePublished": "{{ stampToDate(archive.CreatedTime, '2006-01-02T15:04:05+08:00') }}",
"dateModified": "{{ stampToDate(archive.UpdatedTime, '2006-01-02T15:04:05+08:00') }}",
"author": {
"@type": "Person",
"name": "安企CMS官方团队" {# 这里可以替换为具体的作者字段或自定义文本 #}
},
"publisher": {
"@type": "Organization",
"name": "{% system with name='SiteName' %}",
"logo": {
"@type": "ImageObject",
"url": "{% system with name='SiteLogo' %}"
}
},
"description": "{% tdk with name='Description' %}"
}
</script>
{% endjsonLd %}
In this code block:
- We first defined
@contextand@typeIndicates that this is a Schema.org'sArticleType. headline(Article Title),description(Article description) Directly used the TDK tag built into Anqi CMS to obtain, which ensures consistency between data and page SEO settings.image(Article main image) andLogo(Website Logo) usedarchiveDetailandsystemtag to get the image URL. If the article has multiple images, you canimageadd more URLs in the array.datePublished(Publish date) anddateModified(Modify date) Passedarchive.CreatedTimeandarchive.UpdatedTimeGet timestamp and use itstampToDateFormat it into a time string in ISO 8601 standard, which is a requirement for Json-LD date format.authorandpublisher(Publisher information) fills in the article author and website name/Logo, this information can also be obtained from the system settings of AnqiCMS.
Assume you have a product detail page and want to display product price, inventory information, and also want to add custom user reviews (even if the review content itself is not in the default Json-LD).