In AnQi CMS, Json-LD custom tag call{% jsonLd %}Where should it be placed in the template?

In the era of digital marketing, the importance of Search Engine Optimization (SEO) is self-evident.And structured data, especially Json-LD, is one of the powerful tools to enhance the visibility of websites in search results.AnQi CMS is an efficient system designed for enterprise-level content management and SEO optimization, naturally also providing comprehensive Json-LD support.{% jsonLd %}Where should the custom call tag be placed in the template to achieve its **effect and avoid potential problems, which is often a topic worth discussing.

What is Json-LD and why does AnQi CMS value it?

Json-LD, which stands for JavaScript Object Notation for Linked Data, is a recommended format for embedding structured data directly into HTML pages.It describes page content in a way that is easily understandable by search engines, thereby helping websites to display richer snippets (Rich Snippets) in search results, such as review stars, product prices, event dates, etc., significantly improving click-through rates.

The Anqi CMS was designed with SEO-friendliness in mind, and many of its built-in advanced SEO tools (such as Sitemap generation, Robots.txt configuration, keyword library management, 301 redirection, and pseudo-statics, etc.) are aimed at helping users optimize their website performance.By default, when AnQi CMS enables structured data in the background, it will automatically insert the basic Json-LD structure on the page, which is a good starting point for most websites.

Understand AnQi CMS in depth{% jsonLd %}Tag

However, website content varies greatly, and the default Json-LD structure may not meet all the refined SEO needs. For example, you may need to add more specific Schema attributes for certain types of articles, or define richer product information for product detail pages. At this point,{% jsonLd %}The custom call label is in use.

This tag allows you to declare your own Json-LD content in the template. It is worth noting that AnQi CMS handles these custom contents very intelligently: it willautomatically mergeThe Json-LD you define is different from the Json-LD generated by the system. This means that if the custom field you define conflicts with the default field, your definition will beoverrideThe default value, thus achieving more flexible control. Of course, the前提 is that the Json-LD content you customize must comply with its official grammar specification.

{% jsonLd %}The placement position of the label**

Where should this powerful custom tag be placed in the template? Based on SEO practices and the template mechanism of AnQi CMS, here are our suggestions:

Json-LD is essentially metadata that describes page content, although search engines can parse Json-LD placed in any location of an HTML document (whether it is or not )<head>Or<body>However, the structured data is placed in the HTML document's<head>sectionIt is generally considered to be more standardized and recommended practice.The benefit of doing this is that search engine crawlers can discover and process these important metadata earlier when parsing the page, thereby possibly understanding the page content faster and generating rich media search results.

By combining the Anqi CMS template structure, we can divide the placement strategy into two cases:

  1. Global or General Json-LD (such as “Organization” or “Website” Schema):If your Json-LD is used to describe the entire website or company information, such as your website name, Logo, contact information, etc., this information will appear on every page of the website. In this case, the most ideal placement is yourMaster template file (for examplebash.htmlor the global layout file you define) of<head>inside the tag. Place the code here to ensure that all pages inheriting this master template automatically include these Json-LD data, avoiding the trouble of adding them repeatedly on each subpage.

  2. Page-specific or content-specific Json-LD (such as "Article", "Product", or "Service" Schema):If your Json-LD is optimized for specific types of page content, such as article detail pages (Article Schema), product detail pages (Product Schema), or single pages (WebPage Schema), then it should be placed inDetailed page template file for the content modelIn. For example, for an article detail page, you might be inarchive/detail.htmltemplate file<head>using tags inside{% jsonLd %}Label. This ensures that the Json-LD data is highly relevant to the page content, enhancing the accuracy and effectiveness of structured data.

In any case, make sure your{% jsonLd %}Label wrapping standard<script type="application/ld+json">Label, and write your Json-LD data within it. Here is an example:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>{% tdk with name="Title" siteName=true %}</title>
    <meta name="keywords" content="{% tdk with name="Keywords" %}">
    <meta name="description" content="{% tdk with name="Description" %}">
    {%- tdk canonical with name="CanonicalUrl" %}
    {%- if canonical %}
    <link rel="canonical" href="{{canonical}}" />
    {%- endif %}

    {# 放置Json-LD自定义标签的**位置之一 #}
    {% jsonLd %}
    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "Article",
      "headline": "{{ archive.Title }}",
      "image": [
        "{{ archive.Logo }}"
      ],
      "datePublished": "{{ stampToDate(archive.CreatedTime, "2006-01-02T15:04:05+08:00") }}",
      "author": {
        "@type": "Person",
        "name": "安企CMS运营团队"
      },
      "publisher": {
        "@type": "Organization",
        "name": "{% system with name="SiteName" %}",
        "logo": {
          "@type": "ImageObject",
          "url": "{% system with name="SiteLogo" %}"
        }
      }
    }
    </script>
    {% endjsonLd %}

    <!-- 其他CSS、JS等资源 -->
</head>
<body>
    <!-- 页面主体内容 -->
</body>
</html>

In the above example, we utilized the Anqi CMS template provided{{ archive.Title }}/{{ archive.Logo }}/{% system with name="SiteName" %}Variables wait, dynamically fill Json-LD data so that it can adapt to the content needs of different pages.

Summary

Will install the AnQi CMS.{% jsonLd %}Custom tags calling placed in the template.<head>Part is **practical, whether it is global or specific to a content model**bash.html,detail.htmlThis not only conforms to SEO standards, but also ensures that Json-LD data is efficiently parsed by search engines. By flexibly applying this tag, and