As an experienced website operations expert, I am well aware of the importance of structured data in the increasingly complex search engine environment.It is not only a tool to enhance website visibility but also a key to help search engines understand web page content, thereby displaying richer search results (Rich Snippets).Json-LD is the mainstream way to implement structured data, and its flexibility and powerful features are highly praised.

Today, let's delve deeply into a question that many AnQiCMS users and potential users are concerned about: 'Does AnQiCMS support the introduction of external data in Json-LD?'

AnQiCMS and Json-LD: The Foundation of Flexible Embedding

Firstly, we can clearly answer this question: AnQiCMSFully SupportedIntroducing external data in JSON-LD and providing a highly flexible way to meet this need.This is thanks to the powerful and easy-to-use template engine of AnQiCMS and its modular and scalable system architecture.

AnQiCMS knows the core position of structured data in SEO, and therefore considers good support for Json-LD from the beginning of system design.It is not only simply outputting predefined structured data, but also granting operators and developers great freedom.{% jsonLd %} ... {% endjsonLd %}The label. This label is a "container" specially designed by AnQiCMS for custom Json-LD content.

The delicacy of this mechanism lies in the fact that you only need to write your structured data in standard JSON-LD format within this tag, and AnQiCMS will automatically recognize and process it during page rendering. What's more, AnQiCMS allows you to do this in the JSON-LD structure, Seamlessly embedded any data that can be obtained through AnQiCMS template tags.

How to introduce "external" data managed by AnQiCMS in Json-LD

When we talk about 'external data', it may have various meanings.In the context of AnQiCMS, it can be either system-built-in data that needs to be dynamically called (such as different article titles, descriptions, images), or custom data with more business characteristics that you introduce through a custom content model, or even truly external API data passed to the template after preprocessing by the AnQiCMS backend.

With these custom data, you can use various powerful template tags provided by AnQiCMS within the Json-LD tag (such asarchiveDetailGet article details,categoryDetailGet category details,systemGet global system settings,contactGet contact information,diyGet custom parameters, etc.), and dynamically fill this information into the Json-LD structure.

For example, if you are building a product detail page, you need to add Product Schema (structured data for the product), and the product's 'price' and 'brand' information is stored in custom fields. You can do it like this:

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "{% archiveDetail with name='Title' %}",
  "image": "{% archiveDetail with name='Logo' %}",
  "description": "{% archiveDetail with name='Description' %}",
  "offers": {
    "@type": "Offer",
    "priceCurrency": "USD",
    "price": "{% archiveDetail with name='Price' %}", {# 假设'Price'是产品模型的一个自定义字段 #}
    "availability": "https://schema.org/InStock",
    "url": "{% archiveDetail with name='Link' %}"
  },
  "brand": {
    "@type": "Brand",
    "name": "{% archiveDetail with name='BrandName' %}" {# 假设'BrandName'是产品模型的另一个自定义字段 #}
  }
}
</script>
{% endjsonLd %}

In this example,PriceandBrandNameThis is the "external data" introduced by custom content models.They are flexibly managed in the AnQiCMS backend and precisely mapped to the corresponding fields of Json-LD through template tags, enabling search engines to clearly understand the key properties of the product.

The true meaning of external data integration: the power of backend extension

What about the 'true external data' that needs to be fetched in real-time from third-party APIs, which the website itself does not store?For example, the price or stock status of a product needs to be synchronized in real-time with an e-commerce platform's API, or certain reference data in an article needs to be fetched in real-time from a scientific database.

AnQiCMS as a system developed based on the Go language, its 'modular design' and 'easy extensibility' characteristics provide a solid foundation for this deep integration.Although AnQiCMS's template engine (based on Django template syntax) does not directly support making external API requests in front-end templates, this can be easily achieved by the backend in Go language.

This means that you can or integrate third-party APIs at the AnQiCMS backend logic layer (Go language level) through secondary development, or by utilizing extension plugins that AnQiCMS may provide in the future.Once this external data is successfully retrieved by the backend, AnQiCMS can process it and inject it into the 'context' of page rendering, making it available as a normal variable or object in the template.{% jsonLd %}These external data injected by the backend are used within tags. For example, the backend can pull real-time exchange rates from external APIs at regular intervals and cache them, then use a simple{{ exchangeRate.USD_CNY }}Introduce the variable into the Json-LD.

Summary

In summary, AnQiCMS shows excellent flexibility and extensibility in introducing external data in Json-LD.Whether through custom content model management and calling specific business data, or through backend extension and deep integration with third-party APIs, AnQiCMS can provide effective solutions.