How to debug Json-LD output in AnQiCMS template?

Calendar 78

In the operation practice of AnQiCMS (AnQiCMS), structured data (usually presented in the form of Json-LD) plays a vital role.It can help search engines better understand the content of the page, leading to richer search results (Rich Snippets), and significantly improve the visibility and click-through rate of the website.However, the writing and integration of Json-LD are not a one-time task, especially at the template level, where we often need to fine-tune its output content to ensure the accuracy and integrity of the data.

AnQi CMS is a system designed specifically for content operators and SEO-friendly, naturally understanding this path.It not only integrates the basic structured data output mechanism, but also provides flexible template tags, allowing operators and developers to deeply customize the content of Json-LD.Next, let's delve into how to debug the output content of Json-LD in AnQiCMS templates.

Understand the Json-LD mechanism of AnQiCMS

Firstly, we need to understand the basic way of handling Json-LD by AnQi CMS. According to the document description, when the structured data feature is turned on in the background, the system will default to insert one<script type="application/ld+json"></script>Label, which contains basic structured data. This saves us the work of starting from scratch.

But what truly gives us flexible control is the Anq CMS provided.{% jsonLd %} ... {% endjsonLd %}Template tag. This tag allows us to define or modify Json-LD content directly in the template. Its cleverness lies in the fact that if you are{% jsonLd %}The tag writes a custom Json-LD field, and Anqi CMS will automatically merge it with the default output data of the system.If your custom field conflicts with the default field, your custom content will override the system default value, which provides us with powerful customization capabilities.

Why do you need to debug Json-LD?

Even though AnQiCMS provides an intelligent merging mechanism, debugging Json-LD is still an indispensable step. The reasons are usually as follows:

  1. Syntax errorThe essence of Json-LD is JSON format, any missing comma, quote, or bracket can cause the entire structured data to fail.
  2. The content is inaccurate.The system default or the data we manually fill may not match the actual content on the page, or some key fields may be missing.
  3. Mismatched patternWe expect to generate specific types of Rich Snippets (such as articles, products, comments, etc.) for the page, but the actual output Json-LD may not meet the requirements of the corresponding Schema.org types.
  4. Priority issue: Sometimes a page may have multiple structured data sources, and we need to ensure that the Json-LD output by AnQiCMS has the correct priority and does not conflict with other data sources.
  5. Search engine verification failed: Google and other search engines provide structured data testing tools, debugging is to ensure that the final output can pass these tools verification.

Build and modify Json-LD content in the template

To debug Json-LD, we first need to find or create it in the template. The template files of Anqi CMS are usually located/templateUnder the directory, and use syntax similar to Django template engine. For example, the article detail page might bearticle/detail.htmlor directly inbase.htmlto define common structures.

We can use in the page's<head>area,{% jsonLd %}Label to wrap our Json-LD code:

{% jsonLd %}
<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "Article",
    "headline": "{% archiveDetail with name='Title' %}",
    "description": "{% archiveDetail with name='Description' %}",
    "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": "{% system with name='SiteName' %}"
    },
    "publisher": {
        "@type": "Organization",
        "name": "{% system with name='SiteName' %}",
        "logo": {
            "@type": "ImageObject",
            "url": "{% system with name='SiteLogo' %}"
        }
    }
}
</script>
{% endjsonLd %}

In the above example, we utilized various tags provided by AnQiCMS to dynamically populate Json-LD data:

  • {% archiveDetail with name='Title' %}Get the article title.
  • {% archiveDetail with name='Description' %}Get the article description.
  • {% archiveDetail with name='Logo' %}Get the article thumbnail as an image.
  • {{ stampToDate(archive.CreatedTime, "2006-01-02T15:04:05Z07:00") }}and{{ stampToDate(archive.UpdatedTime, "2006-01-02T15:04:05Z07:00") }}Format the publish and update time.
  • {% system with name='SiteName' %}and{% system with name='SiteLogo' %}Get the website name and Logo.

These tags ensure that the Json-LD data is synchronized with the actual content of the current page.

The core tool for Json-LD debugging:dumpFilter

During the debugging of Json-LD,dumpThe filter is undoubtedly one of the most powerful tools provided by AnQi CMS. Its purpose is to print the structure type and value of variables, which is crucial for understanding the data flow and troubleshooting.

How to usedumpHow to debug Json-LD? We can't directlydumpthe whole<script type="application/ld+json">tag, because the Json-LD data has been wrapped. We should construct Json-LD'sDuring, performing on key variablesdump.

For example, if you suspect that the article title or description has not been correctly obtained, you can do it first in the Json-LD constructiondumpThese variables:

”`twig {# Assume we are on the article detail page, the archive object is available in the context #} {% set articleTitle = archive

Related articles

Does Json-LD automatically add `itemprop` and other microdata tags, or only support JSON-LD?

As an experienced website operations expert, I am happy to give you a detailed explanation of AnQiCMS's support strategy for structured data, especially JSON-LD and traditional microdata tags.In today's Search Engine Optimization (SEO) environment, structured data plays a crucial role, helping search engines to accurately understand your web page content, thereby improving the visibility and display format of your website in search results.### The structured data support of AnQi CMS: Deep analysis of JSON-LD and microdata tags In content operation practice

2025-11-06

The website is closed, will Json-LD still output normally or how should it be handled?

In website operation, we often encounter situations where we need to maintain, upgrade, or even temporarily close the website.In this "closed station" state, many operators will have doubts: Will the JSON-LD structured data we have carefully configured for SEO still be output normally?How should it be handled to minimize the impact on search engine optimization (SEO) as much as possible?As an experienced website operation expert, I will combine the characteristics of AnQiCMS (AnQiCMS) to deeply analyze this issue for everyone.### Deeply understand the "shutdown" mechanism of Anqi CMS First

2025-11-06

How to ensure the correct setting of the `@type` attribute for different page types when customizing Json-LD?

As an experienced website operations expert, I fully understand the importance of structured data (Structured Data) in modern search engine optimization (SEO).It is like a 'resume' of your website content, directly telling search engines what your page is about and what key information it contains.While Json-LD is a recommended structured data format, the correct setting of its `@type` attribute is crucial to ensure that search engines can accurately understand the core content of your page.Today, let's delve deeply into AnQiCMS (AnQiCMS)

2025-11-06

How to use the `archiveParams` tag to retrieve custom fields and include them in Json-LD?

As an experienced website operation expert, I am well aware of the importance of structured data in today's search engine optimization.Make good use of structured data, not only can it help search engines better understand your content, but also helps to get richer display opportunities in search results.AnQiCMS (AnQiCMS) is a powerful and flexible content management system that provides excellent support in this regard.

2025-11-06

Can Json-LD directly reference the image resource address of AnQiCMS, such as the thumbnail URL?

## Empowering Structured Data: Direct Reference Strategy for Anqi CMS Image Resources in Json-LD As an experienced website operations expert, I am well aware of the importance of structured data (Structured Data) in today's search engine optimization (SEO) field, which is self-evident.It not only helps search engines better understand page content, but is also the key to obtaining rich search results (Rich Snippets).While Json-LD is the mainstream implementation of structured data, its accuracy and completeness directly affect the exposure and click-through rate of a website

2025-11-06

Can AnQiCMS's Json-LD combine `nextArchive` and `prevArchive` tags to generate structured data for related articles?

As an experienced website operations expert, I know that structured data plays a crucial role in modern search engine optimization.It can help search engines understand web content more accurately, thus giving them the opportunity to display richer search results (Rich Snippets), attracting more users to click.AnQiCMS (AnQiCMS) is an enterprise-level content management system that attaches great importance to SEO and naturally provides strong support and flexible customization space in this regard.

2025-11-06

How to get the list of all configured multilingual sites in AnQiCMS?

As an experienced website operations expert, I am well aware that having a website that supports multiple languages is crucial for businesses to expand their markets and enhance brand influence in today's global digital world.AnQiCMS (AnQi CMS) is an efficient and flexible content management system that provides excellent support in this regard.It can not only help us build multiple independent sites, but also allow these sites to easily switch between different languages, meeting the needs of global users.

2025-11-06

How to use the `languages` tag in AnQiCMS templates to display language options?

In today's globalized digital world, multilingual support for websites has become crucial for expanding markets and serving a diverse range of user groups.AnQiCMS (AnQiCMS) is well-versed in this field, deeply integrating multilingual functionality into its core architecture, committed to providing lightweight and efficient content management services to support the company's global layout.For website operators and template developers, understanding how to efficiently use the `languages` tag in AnQiCMS templates to display multilingual options is a required course for building internationalized websites.###

2025-11-06