In today's digital marketing environment, the importance of Search Engine Optimization (SEO) is self-evident, and structured data is one of the key factors for improving the performance of a website on the Search Engine Results Page (SERP).AnQiCMS as a system focusing on providing high-efficiency content management solutions, its flexible customization and output of Json-LD structured data in templates provide website operators with powerful SEO optimization tools.

Structured data: the 'language' of search engines

Json-LD (JavaScript Object Notation for Linked Data) is a lightweight data format that uses JSON syntax to represent entities and their relationships on web pages.For search engines, Json-LD is like a clear summary of website content, which can help them understand the page content more accurately, such as the theme of the page, the author, the publication date, product price, review stars, etc.Correctly implementing Json-LD can make your content displayed in search results as 'Rich Media Snippets', such as showing article thumbnails, rating stars, or event dates, thereby significantly increasing the visibility and click-through rate of your content.

AnQiCMS was designed with SEO-friendliness in mind from the beginning, providing a series of advanced SEO tools such as pseudo-static, keyword management, and Sitemap generation.On this basis, through its powerful template engine, you can go further and precisely control the Json-LD output of the page to meet more complex business needs and search engine optimization strategies.

AnQiCMS中的Json-LD自定义输出机制

AnQiCMS knows the diversity of website content, therefore it provides high flexibility at the template level to manage structured data.The system default may have already generated some basic structured data, but in order to adapt to the characteristics of different types of content such as articles, products, and events, you often need to customize more detailed and targeted Json-LD.

在AnQiCMS的模板中,您可以使用一个专门的标签{% jsonLd %}...{% endjsonLd %}To implement custom output of structured JSON-LD data.The design concept of this label is: allow you to write any JSON code that conforms to the JSON-LD specification in it.It is more important that it does not simply replace the Json-LD output that AnQiCMS may already have, but will intelligently merge with the default data.This means that if the field you customize conflicts with the field generated by default, your customized data will have higher priority and thus overwrite the default value.This merging mechanism ensures that you can take advantage of the convenience provided by the system while also having complete control over the final output.

For example, a basic custom Json-LD output structure may look like this:

{% jsonLd %}
<script type="application/ld+json">
{
	"author": "您的公司名称",
	"image": [
		"https://您的网站.com/默认图片.png"
	]
}
</script>
{% endjsonLd %}

Combine template tags to dynamically output Json-LD data

It is not enough to simply output JSON-LD statically to maximize its effectiveness.The real strength of Json-LD lies in its ability to dynamically capture specific content on the page and structure it.AnQiCMS rich template tag system makes this process very smooth.You can easily insert dynamic information such as article title, description, image, publishing time, etc. into the Json-LD code using template tags.

The following is an example of how to output Json-LD by combining common content types (such as article detail pages) with AnQiCMS template tags.

1. 文章(Article)Json-LD示例

在文章详情页的模板中,您可以这样构建Json-LD:

{% with articleTitle = archive.Title %}
{% with articleDesc = archive.Description %}
{% with articleLink = archive.Link %}
{% with articleLogo = archive.Logo %}
{% with articleCreatedTime = stampToDate(archive.CreatedTime, "2006-01-02T15:04:05+08:00") %}
{% with articleUpdatedTime = stampToDate(archive.UpdatedTime, "2006-01-02T15:04:05+08:00") %}
{% with siteName = system.SiteName %}
{% with siteLogo = system.SiteLogo %}

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "{{ articleLink }}"
  },
  "headline": "{{ articleTitle }}",
  "image": [
    "{{ articleLogo }}"
  ],
  "datePublished": "{{ articleCreatedTime }}",
  "dateModified": "{{ articleUpdatedTime }}",
  "author": {
    "@type": "Person",
    "name": "(此处可动态获取作者名,例如:{% archiveDetail with name="author" %})"
  },
  "publisher": {
    "@type": "Organization",
    "name": "{{ siteName }}",
    "logo": {
      "@type": "ImageObject",
      "url": "{{ siteLogo }}"
    }
  },
  "description": "{{ articleDesc }}"
}
</script>
{% endjsonLd %}

{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}

In this example, we utilized AnQiCMS'sarchiveobject (used to get the details of the current article),systemobject (used to get the global settings of the website), as well asstampToDateThe filter is used to format time to meet the time format required by Json-LD.{% archiveDetail with name="author" %}It can be used to obtain the author information from the custom fields of the article.

2. Product (Product) Json-LD example

For product detail pages, you can add more unique product information, such as price, stock, reviews, etc:

{% Ld %} English