AnQi CMS has always been committed to providing efficient and flexible solutions in content operation and search engine optimization.Structured data, especially JSON-LD, is an important means of enhancing the visibility of website content in search engines.It can help search engines understand the page content more accurately, thus giving them the opportunity to display richer search results (i.e., rich media abstracts), attracting more users to click.

AanQi CMS understands the importance of structured data, and has preset some default JSON-LD structured data for you in the system design. When your website publishes articles, products, or single pages, AanQi CMS usually automatically generates some basic JSON-LD code based on the page type and content, such asWebPage/ArticleWait, these codes exist silently in the HTML code of the page, waiting to be indexed and parsed by search engines. You can view the source code of the page in the browser (usually right-click on the page -> "View Page Source" or "Inspect Element"), then search at the top or bottom of the page.<script type="application/ld+json">Label to confirm that the system has generated these default data for you.

However, in the actual content operation, we often need to control these structured data more finely to meet specific business needs, such as adding detailed information to product pagesProductorOfferInformation, specify more specific for a particular articleArticleType, or add additional structured data such as author, review, event, etc. At this point, the template customization feature provided by Anqi CMS comes into play.

AnQi CMS uses its powerful template engine to allow you to customize or override the JSON-LD in the page. The core is to use a special template tag:{% jsonLd %} ... {% endjsonLd %}This tag is used to wrap your custom JSON-LD snippet.When the content within this tag is parsed, Anqicms will automatically merge it with the JSON-LD generated by the system by default.If the field in your custom code conflicts with the default generated field, your custom field will override the default field to achieve flexible customization.

The specific operation steps are usually as follows:

First, you need to determine which page type you want to customize JSON-LD. This may include article detail pages (such as:article/detail.html)、product detail page(for example:product/detail.html)、single page(for example:page/detail.html)even the homepage(for example:index/index.html)。These template files are located in the template directory of your website.

Next, open the template file you wish to modify. In the file<head>area (although it can be placed in<body>it can also be recognized by search engines, but it is generally recommended to place it in<head>To ensure that it is parsed as soon as possible, you can use{% jsonLd %}tags to embed your custom JSON-LD. For example, if you want to add more richArticleType data, including publisher, main entity link, publication date, and modification date, you can write it like this:

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Article",
  "headline": "{{ archive.Title }}",
  "image": [
    "{{ archive.Logo }}"
  ],
  "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": "{{ archive.Author|default:"安企CMS编辑团队" }}"
  },
  "publisher": {
    "@type": "Organization",
    "name": "{% system with name="SiteName" %}",
    "logo": {
      "@type": "ImageObject",
      "url": "{% system with name="SiteLogo" %}"
    }
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "{{ archive.Link }}"
  },
  "description": "{{ archive.Description|truncatechars:150 }}"
}
</script>
{% endjsonLd %}

In this example, we used the Anqi CMS template tags to dynamically retrieve page content.{{ archive.Title }}Used to retrieve the article title,{{ archive.Logo }}Used to obtain the thumbnail,{{ stampToDate(...) }}Used to format timestamps.{% system with name="SiteName" %}and{% system with name="SiteLogo" %}The website name and Logo are retrieved separately. If the article does not have an author set,{{ archive.Author|default:"安企CMS编辑团队" }}a default value will be provided to ensure data integrity.

Please ensure that the syntax of the custom JSON-LD is correct and conforms to schema.org standards.Any syntax error can cause search engines to fail to parse, thereby losing the advantages brought by structured data.You can use the Rich Results Test tool provided by Google or the structured data testing tool to validate your code.

By this means, you can flexibly adjust and optimize structured data according to your business needs, for different page types, even for individual pages, in order to win a better performance for your website in search engines.This feature of AnQi CMS allows content operators to participate more deeply in the control of SEO details, truly realizing fine-grained operation.


Frequently Asked Questions (FAQ)

  1. How to confirm that Anqie CMS has automatically generated JSON-LD structured data?You can view the page source code by right-clicking on any page in the browser and selecting “View Page Source” (or pressCtrl+U/Command+Option+U), then search in the opened source code page.<script type="application/ld+json">Label. If found, it means that Anqicms has generated the default JSON-LD data for you.

  2. Can I completely remove the JSON-LD generated by Anqicms by default?The AnQi CMS encourages optimization and expansion of default structured data in its design, rather than complete removal. If you need to completely override a default field, just in{% jsonLd %}Provide your own identical field within the tag. If you want a page to not display any structured data, you can try to override an empty JSON-LD object in the template, for example:{% jsonLd %}<script type="application/ld+json">{}</script>{% endjsonLd %}But this is usually not recommended because structured data is beneficial for SEO.

  3. What will happen if I make a mistake in my custom JSON-LD code?If your JSON-LD code contains syntax errors or does not conform to schema.org standards, search engines may not be able to parse it correctly.This may cause your page to fail to obtain rich media summaries, and may even result in errors reported in Google Search Console.It is strongly recommended to immediately use Google's rich media search results testing tool after deploying custom JSON-LD code to ensure its validity.