In today's highly competitive online environment, making website content more understandable to search engines is the key to improving visibility.Structured data, particularly in Json-LD format, is the important way for us to "talk" with search engines, which can help search engines accurately identify page content and may be displayed in the form of rich media summaries (Rich Snippets) in search results, thereby attracting more clicks.
AnQiCMS (AnQiCMS) was designed with SEO friendliness in mind from the beginning, including powerful advanced SEO tools, such as the function to automatically generate basic structured data.This enables the website to include default Json-LD data in the page when publishing content without additional configuration, convenient for search engines to crawl.jsonLdthe tag.
What is structured data (Json-LD)?
When a search engine recognizes Json-LD data on a page, it can understand the page context more deeply, which not only helps to improve the ranking of the website in relevant search queries but also gives it a better chance to be displayed more prominently on the search results page, such as with star ratings, images, prices, publication dates, etc., which we call "rich media snippets" or "rich results".These rich results are usually more attractive than ordinary search results and can effectively improve user click-through rates.
How does AnQi CMS handle structured data?
The AnqiCMS will automatically generate a default Json-LD data according to the page type (such as article detail page, product detail page). For example, for a blog article, it may automatically generateArticleA type of JSON-LD that includes title, author, publish date, and other basic information. This automated processing greatly simplifies the operation, and it is sufficient for most websites.
However, if we need to add more details to the default data or want to override certain default fields, or even customize a completely different Schema (structured data type) for a specific page type, we need to use the Anqi CMS template.jsonLdLabel.This tag allows us to embed custom Json-LD code into the template as if we were editing plain HTML, thereby enabling fine-grained control over structured data.
Deep understandingjsonLdLabel: Custom structured data
Anqi CMS'jsonLdThe label is very flexible in design. Its basic usage is:
{% jsonLd %}
<script type="application/ld+json">
{
// 在这里编写您的自定义 Json-LD JSON 对象
}
</script>
{% endjsonLd %}
It is worth noting that when you usejsonLdWhen tagging, the Json-LD data you define in it will be merged with the default data automatically generated by Anqicms.This means, you do not need to write the entire Json-LD object to replace the entire default data, just provide the fields you want to add or modify.If your custom field conflicts with the default field (i.e., they have the same name), your custom content will take precedence and override the default field.This provides a powerful and convenient way for us to customize the default features.
While usingjsonLdWhen customizing tag content, be sure to pay attention to the strictness of JSON syntax.Any bracket, comma, or quotation mark error can cause the entire structured data to fail, and the search engine will not be able to parse it correctly.
Applied: Custom Common Schema Type
Now, let's look at how to use with several practical examplesjsonLdLabel and AnQi CMS existing data labels, add more structured data to different types of pages.
1. Enhance the structured data of the Article (Article) page.
For the article detail page, Anqi CMS usually generates a basicArticleSchema. We can add more details throughjsonLdtags, such as author information, image galleries, or update times.
Assuming we want to add specific author names to the article and specify an image representing the article:
{% jsonLd %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"author": {
"@type": "Person",
"name": "{% archiveDetail with name='Author' %}" // 假设我们在后台自定义了“Author”字段
},
"image": [
"{% archiveDetail with name='Logo' %}" // 使用文章的封面首图作为主图
],
"dateModified": "{{ stampToDate(archive.UpdatedTime, '2006-01-02T15:04:05-07:00') }}" // 使用更新时间
}
</script>
{% endjsonLd %}
In this example, we use{% archiveDetail %}Label dynamically retrieves the custom author field and cover image URL of the article and usesstampToDateThe filter formats the update time of the article to comply with the ISO 8601 standard, allowing search engines to better understand this information.
2. Optimize the structured data of the Product page
The product page is a key point for e-commerce and display websites. We can utilizeProductSchema to display product information such as price, inventory, brand, and reviews, thus showing rich media summaries in search results, such as star ratings and price ranges.
{% jsonLd %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": "{{ archive.Title }}",
"image": [
"{% archiveDetail with name='Logo' %}"
],
"description": "{{ archive.Description|truncatechars:150 }}", // 截取描述,避免过长
"sku": "{% archiveDetail with name='ProductSKU' %}", // 假设有自定义产品SKU字段
"brand": {
"@type": "Brand",
"name": "{% system with name='SiteName' %}" // 使用网站名称作为品牌
},
"offers": {
"@type": "Offer",
"url": "{{ archive.Link }}",
"priceCurrency": "CNY", // 货币类型
"price": "{% archiveDetail with name='Price' %}",
"availability": "https://schema.org/{% if archive.Stock > 0 %}InStock{% else %}OutOfStock{% endif %}", // 根据库存判断可用性
"itemCondition": "https://schema.org/NewCondition"
},
"aggregateRating": { // 如果有评论和评分系统,可以添加此项
"@type": "AggregateRating",
"ratingValue": "4.5", // 示例值,实际应从评论数据中获取
"reviewCount": "123" // 示例值
}
}
</script>
{% endjsonLd %}
Here we combinedarchive.Title/archive.Description/archive.LinkUniversal fields for articles, as well as{% archiveDetail with name='Price' %}Fields specific to product models. Even through{% if archive.Stock > 0 %}such logical judgments, dynamic inventory status display was achieved.
3. Add Local Business (LocalBusiness) structured data
For businesses with physical stores or service areas,LocalBusinessSchema can make your business information stand out in local search results, such as on Google Maps or in the knowledge panel.
Generally, you can add such data to the homepage, about us page, or contact us page of the website.
”`twig {% Ld %}