When building and optimizing a website, we always hope to let the search engine deeply understand the content of our page, so that we can get a better display effect in the search results.Structured data, especially structured data presented in JSON-LD format, is an important tool to achieve this goal.AnQiCMS (AnQiCMS) is a content management system that focuses on SEO optimization and provides flexible and powerful support for inserting custom JSON-LD.
Understand the advantages of structured data and AnQi CMS
Search engines crawl web content through spiders, but text and images alone cannot fully convey the 'meaning' of the content.For example, an article about the 'AnQiCMS feature introduction' is clear to humans, but to search engines, it may just be a piece of text.If we can clearly tell the search engine that this is an article about a software product, titled 'AnQiCMS Feature Introduction', by someone, published at a certain time, with core features including content model and SEO tools ..., then the search engine can better understand and may display it in the form of 'rich media search results' (Rich Snippets), such as with star ratings, images, and publication dates, which will undoubtedly greatly increase the click-through rate of the page.
AnQi CMS provides many out-of-the-box features in SEO, such as pseudo-static, Sitemap generation, keyword library management, TDK (title, description, keywords) customization, and more.These are the basics of website SEO, and JSON-LD structured data is an advanced optimization on this basis, which can enhance the search engine's understanding of content from 'reading' to 'understanding', thereby obtaining more accurate display.
jsonLdThe core role of tags
In Anqi CMS, the system usually inserts some basic structured data in the page for the convenience of users. But if we want to finely control or supplement these data according to the needs of a specific page, we need to use the data provided by Anqi CMS.jsonLd.
jsonLdThe tag usage is very intuitive, it adopts{% jsonLd %} ... {% endjsonLd %}This structure. Its core function is to allow us to insert or modify structured data in pure JSON-LD format.What is most remarkable is that this tag is not simply replaced, but is merged with the structured data built into Anqi CMS.This means that we do not need to write the entire JSON-LD object from scratch, but only provide the fields that we want to customize or supplement.If a custom field conflicts with the system-generated field, the content we manually set will take precedence, which provides great convenience for deep customization.
How to build custom JSON-LD
The key to building custom JSON-LD lies in two points: first, being familiar with the Schema.org specifications, knowing which properties should be included for different types of content;How to obtain dynamic data from Anqi CMS template tags and fill it into JSON-LD.
The AnQi CMS template tag system is very complete, we can easily obtain various information from the page, such as:
- Page TDK tag (
tdk)Get the title, keywords, and description of the current page. - System settings tag (
system)Get the global settings such as website name, Logo, and filing information. - Document details tag (
archiveDetail): Get the title, content, images, publication/update time, custom fields, etc. of articles or products. - Category detail tag (
categoryDetail): Get the name, description, images, etc. of categories. - Breadcrumb tags (
breadcrumb)Get the page navigation path.
With these data sources, we can flexibly build JSON-LD that conforms to Schema.org standards.
For example, let's take the article detail page, assuming we want to optimize the structured data of the article:
We can place the following code snippet in the template of the article detail page (for example{模型table}/detail.html)的<head>area:
{% jsonLd %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "{% archiveDetail with name='Title' %}",
"image": [
"{% archiveDetail with name='Logo' %}"
],
"datePublished": "{{ stampToDate(archive.CreatedTime, '2006-01-02T15:04:05Z07:00') }}",
"dateModified": "{{ stampToDate(archive.UpdatedTime, '2006-01-02T15:04:05Z07:00') }}",
"author": {
"@type": "Person",
"name": "这里可以填写文章作者名,也可以动态获取"
},
"publisher": {
"@type": "Organization",
"name": "{% system with name='SiteName' %}",
"logo": {
"@type": "ImageObject",
"url": "{% system with name='SiteLogo' %}"
}
},
"description": "{% archiveDetail with name='Description' %}"
}
</script>
{% endjsonLd %}
Through the above code, we defined the article's title, main image, publication/revision time, author, publishing organization, and description. Among which{% archiveDetail %}/{% system %}as well asstampToDateFunctions directly utilize the data configured in the Anqi CMS backend, avoiding hard coding and repetitive work.
If we also want to add structured data for breadcrumb navigation on the page:
Although AnQiCMS has built-in breadcrumb tags, if you want to provide them to search engines in JSON-LD format, you can do it like this:
{% jsonLd %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{% breadcrumb crumbs %}
{% for item in crumbs %}
{
"@type": "ListItem",
"position": {{ forloop.Counter }},
"name": "{{ item.Name }}",
"item": "{{ item.Link }}"
}{% if not forloop.Last %},{% endif %}
{% endfor %}
{% endbreadcrumb %}
]
}
</script>
{% endjsonLd %}
Here, we cleverly utilized{% breadcrumb crumbs %}The breadcrumb data traversed by tags, dynamically generatedBreadcrumbListStructured data of type.
The benefits of enhancing the display effect of the search engine
ByjsonLdInsert custom structured data, our website will gain many benefits:
- Enhance rich media search results: Search engines may display more rich search results on our pages, such as article thumbnails, publication dates, product prices, star ratings, etc., which can visually attract users and increase click-through rates.
- Enhance content understanding: Structured data clearly defines the entities and relationships of page content, helping search engines better understand the context of page content, so that when users search for related information, our pages are displayed more accurately.
- potential ranking improvementAlthough structured data itself is not a direct ranking factor, it can improve the visibility, click-through rate, and user experience of the page, and these indirect factors are helpful for the website to perform better in search results.
In short, the Anqi CMS'sjsonLdTags provide a simple yet powerful way to control the structured data of a website.By making good use of this feature, combined with Schema.org standards, we can make the content of the website stand out in search engines and attract more target audiences.
Frequently Asked Questions (FAQ)
1. I amjsonLdWill the custom content in the tag overwrite the structured data generated by the default Anqie CMS?Yes,jsonLd