How to customize or override the JSON-LD structured data in AnQi CMS?

Calendar 👁️ 77

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.

Related articles

How to display the Banner slideshow image on the homepage or a specific group?

The homepage and banner carousel images of specific groups, which are key elements in attracting visitors and displaying core content on the website.A convenient and flexible system for management and display, which can greatly improve the operation of your website.AnQiCMS (AnQiCMS) takes advantage of its intuitive design and powerful template tag features, allowing you to effortlessly handle these visual elements, whether it's creating an eye-catching homepage image or customizing exclusive promotional images for specific category pages, you can do so with ease.

2025-11-08

How to implement language switching functionality for multilingual sites in Anqi CMS?

When our website is aimed at serving global customers, providing multilingual support has become an indispensable feature.This can not only help us expand the international market, but also significantly improve the access experience of users in different languages.AnQiCMS (AnQiCMS) fully understands this need, therefore, it has made multilingual support one of its core highlights, allowing us to easily build multilingual websites and switch languages.How to implement language switching for multi-language sites in AnQi CMS

2025-11-08

How to create pagination navigation for document lists, Tag lists, and other Anqi CMS features?

In website operation, providing clear and easy-to-use pagination navigation for content lists not only greatly improves user experience but also optimizes search engine crawling efficiency, helping content to be discovered better.AnQiCMS (AnQiCMS) knows this and therefore provides powerful and flexible pagination tags in template design, allowing content operators to easily create pagination navigation for document lists, tag lists, and so on. We will discuss together how to implement this feature in AnQi CMS templates, organizing your website content neatly.--- ###

2025-11-08

How to generate and display the breadcrumb navigation of the current page in Anqi CMS

When we browse websites, we often see a line at the top or bottom of the page indicating the current location path, such as “Home > Product Category > Electronic Products > Laptop”.This is what we commonly call 'breadcrumb navigation', which not only clearly informs us of our location but also makes it convenient for us to quickly return to the previous level page, greatly enhancing the website's user experience and navigation efficiency.In Anqi CMS, implementing and displaying breadcrumb navigation is a very easy thing to do.The system is built-in with special template tags that can intelligently adapt to the content structure of the current page

2025-11-08

How to obtain the background custom global parameters in the template?

In AnQi CMS, the flexibility and maintainability of the website are one of its core advantages.Content operators and developers often need to dynamically adjust some global information of the website without modifying the template code, such as the company name, contact number, and even some marketing campaign links.These are the background custom global parameters that are the key to achieving this requirement.Today, let's delve into how to easily obtain and display these custom global parameters configured in the Anqi CMS template.### Why do we need global parameters? Imagine that

2025-11-08

How to display the current year or a specified format of time in the template?

In website operation, it is often necessary to keep the web page content up-to-date or accurately display the time of specific events, whether it is the copyright year in the footer, the publication date of the article, or the update time of the product. These dynamic time information can make the website look more professional and active.AnQiCMS provides a very flexible and intuitive way, allowing you to easily display the current year or specify the format of time in templates. Next, we will explore two main methods together, allowing your AnQiCMS website to flexibly display various time information.## One

2025-11-08

How to customize URL rewrite rules in AnQi CMS to optimize SEO?

In website operation, the website structure is not just a string of characters for accessing pages, but also a key factor in the website's performance in search engines.A clear, meaningful, and search engine-friendly URL (Uniform Resource Locator) that can significantly improve the SEO effect of the website, helping the content to be discovered and understood more easily.AnQiCMS (AnQiCMS) knows this and therefore integrated powerful pseudo-static and URL customization features into the system design from the beginning, allowing website operators to flexibly configure URL rules to meet different SEO strategy needs.

2025-11-08

How to set custom URL aliases for articles, categories, and single pages?

On the day when content management is increasingly important, a clear and friendly URL address can not only help search engines better understand the content of the page, improve the SEO performance of the website, but also provide users with a better browsing experience, and even help in brand promotion.AnQiCMS understands this and provides a powerful and flexible custom URL alias feature, allowing you to easily set personalized addresses for articles, categories, single pages, and even tags on your website.Next, we will explore how to finely manage these URL aliases in AnQiCMS.### Core Premise

2025-11-08