How to implement custom JSON-LD structured data in AnQiCMS templates to optimize search results display?

Calendar 👁️ 84

In today's digital marketing environment, having high-quality content is not enough. How to make search engines better understand and display this content is becoming increasingly crucial.Structured data, especially JSON-LD, is a powerful tool at our disposal, which helps our website present more rich and attractive forms in search results, which is what we often call "Rich Snippets".

AnQiCMS (AnQiCMS) is an enterprise-level content management system developed with Go language as the core, which provides many built-in functions for SEO optimization.It not only supports pseudo-static, Sitemap generation, Robots.txt configuration, but also allows us to flexibly customize the content model.For structured data, Anqi CMS defaults to generating a basic JSON-LD data set for the page.But often, we may need to control and expand these data more finely according to our business characteristics to achieve more competitive search result display.

Understand the core value of JSON-LD

Before delving into customization, let's first briefly review the core value of JSON-LD.It is a lightweight data format that describes page content in a machine-readable way by embedding a JSON code in HTML.For example, an article can describe its title, author, and publication date;A product can describe its price, inventory, and reviews. When a search engine reads these structured data, it can understand the page content more accurately, thereby having the opportunity to display richer visual elements in the search results, such as star ratings, images, price ranges, etc., which can significantly increase click-through rates.

The reason why AnQi CMS can become the preferred tool for small and medium-sized enterprises and content operation teams is that it maintains high flexibility while providing powerful functions.Its template system is based on Go language, the syntax is similar to Django template engine, and it is very easy to get started.This flexibility extends to the management of structured data, allowing us to achieve complex JSON-LD customization through simple template operations.

Integration points of AnQiCMS with JSON-LD

The AnQi CMS handles structured data intelligently when the page is loaded. One of its highlights is that it provides a named{% jsonLd %}The special tag plays a very powerful role: if you use it in the template and write custom JSON-LD code within these tags, AnQi CMS will not simply overwrite the default data, but willautomatically mergeYou define the data and the system generated data. This means that if your custom field conflicts with the default field, your custom content will take precedence;If you add a new field that is not present in the default structure, it will be seamlessly added to the final JSON-LD output.

This merging mechanism brings us great convenience: we do not need to build all structured data from scratch, but only focus on the key information that needs to be customized or supplemented.

Practice: Build Custom JSON-LD in AnQiCMS Template

Now, let's go through specific steps and examples to see how to implement custom JSON-LD structured data in Anqi CMS templates.

Step 1: Identify the content type that needs to be optimized

First, think about what types of content are on your website that need to be better understood by search engines. For example, if you are an e-commerce website, product pages (ProductThe structured data of Schema is crucial; if you are a content blog or news media, the article page (ArticleA Schema) should be paid attention to. The flexible content model function of Anqi CMS can exactly meet your needs to define various content structures such as 'articles', 'products', and 'events.'

Second step: Choose the appropriate JSON-LD Schema type

After determining the content type, the next step is to choose the Schema.org standard that best fits your content description. For example:

  • Article detail page: Usually usedArticleOr its subtypes(NewsArticle,BlogPosting)
  • Product details page: Use.Productand combiningOffer/AggregateRatingetc.
  • Company introduction page: Use.OrganizationorLocalBusiness.

The content model of AnQi CMS allows you to define core content types such as 'articles' and 'products', and even create more custom models.

Third step: use{% jsonLd %}Tag injection of custom data

Assuming we want to implement a more perfectarchive/detail.htmlor custom article templateArticlestructured data in the article detail page of AnQi CMS

  1. Open the corresponding template file:Generally, the template for the article detail page may be located/template/你的模板目录/archive/detail.html. You can find and edit it in the "Template Design" feature in the background.

  2. Insert{% jsonLd %}Tags:in the template file's<head>or<body>section (usually recommended in<head>Insert at the end of the tag{% jsonLd %}Tag pair.

  3. Build JSON-LD content and use AnQiCMS tags for dynamic filling:In{% jsonLd %}Internal, write a JSON-LD syntax compliant `<script`

Related articles

How to format a `time.Time` type variable into a readable date string in GoLang in AnQiCMS?

In AnQiCMS, managing website content often involves the need to display dates and times, such as the publication time of articles, update time, or the last login time of users, etc.These time data are typically stored as `time.Time` type in the GoLang backend.When they are passed to the front-end template, if not properly formatted, they may be displayed as a string of hard-to-understand timestamps or the default Go language format, which is obviously not in line with the needs of the visitors we show.

2025-11-09

How to judge whether a string contains a certain keyword in AnQiCMS template and display the result?

In website operation, we often encounter such needs: dynamically adjusting the display mode of content based on specific information of web page content.For example, if an article title contains keywords such as 'Promotion' or 'Activity', we may want it to display an eye-catching label automatically; or, in order to review content and improve user experience, we need to check if there are certain sensitive words in the article and take appropriate actions accordingly.

2025-11-09

How to optimize the page layout display using AnQiCMS template inheritance (`extends`) and inclusion (`include`) tags?

In website construction, how to organize the page structure efficiently to make the code reusable and easy to maintain is the key to improving development efficiency and project quality.AnQiCMS has fully considered this point, providing powerful template inheritance (`extends`) and template inclusion (`include`) tags, allowing us to build websites like building blocks, easily realizing complex page layout and display optimization.

2025-11-09

How to automatically replace and display anchor text in article content in AnQiCMS?

In website operation, anchor text is an important element that connects different pages, enhances content relevance, and optimizes search engine rankings.A well-crafted anchor text can not only guide users to discover more relevant information but also help search engines better understand the content and structure of the page and website.For those of you who use AnQiCMS (AnQiCMS) to manage content, the system provides an efficient and intelligent mechanism to automatically convert keywords in the article content into linked anchor text, thereby greatly improving the efficiency and effectiveness of content operation.

2025-11-09

How does AnQiCMS's `urlizetrunc` filter truncate long URLs and display an ellipsis in the link?

The AnQiCMS `urlizetrunc` filter: Allows long URLs to elegantly transform into ellipses In daily website operations, we often need to reference external links in articles, comments, or product descriptions.These links may be intended to provide references, guide users to access related pages, or display product videos, etc.However, sometimes these URLs can be very long, not only occupying a large amount of page space, affecting the overall layout aesthetics, but also reducing the reading experience of the content.

2025-11-09

How to remove HTML tags in AnQiCMS template and display only plain text content?

In AnQiCMS content management practice, sometimes we encounter the need: to extract pure text information from documents containing rich formats (such as bold, italic, images, links, etc.).This may sound contradictory, content management systems are inherently committed to the diverse display of content, why would one still 'strip' these formats?

2025-11-09

How to automatically identify URLs in text and convert them to clickable `<a>` tags in AnQiCMS?

In content management and website operations, we often need to convert URLs in text into clickable hyperlinks so that users can directly navigate to access.Manual operations are not only inefficient but also prone to omissions, especially on websites with large amounts of content.AnQi CMS understands this pain point and provides an elegant and efficient solution that allows us to easily identify and convert URLs in text.To make Anq CMS automatically identify URLs in text and convert them into clickable `<a>` tags, we mainly use its powerful template filter function.Specifically

2025-11-09

What is the core function of the `urlize` filter in the AnQiCMS template?

In AnQiCMS template development, handling links in content is a common and important link.The `urlize` filter was born to meet this need, it can greatly simplify the recognition and formatting of links in templates, while also taking into account user experience and search engine optimization.### `urlize` filter is the core function in AnQiCMS templates The core function of the `urlize` filter is to intelligently identify URLs and email addresses contained in a piece of plain text content

2025-11-09