In today's highly competitive digital environment, having multiple websites to cover different brands, product lines, or regional markets has become the norm.AnQiCMS (AnQi CMS) leverages its powerful multi-site management capabilities to provide great convenience for enterprises and content operators.However, when it comes to the core link of Search Engine Optimization (SEO) - structured data (Json-LD), how to cleverly integrate the site-specific information into Json-LD in a multi-site mode, so that each site can accurately convey its unique value to search engines, has become an important issue facing us.

Today, let's delve into how Json-LD custom tags effectively differentiate data across different sites in the AnQiCMS multi-site management mode, helping each of your sites stand out in search engines.

Understanding the multi-site management mechanism of AnQiCMS

The multi-site management feature of AnQiCMS is one of its core strengths.It allows you to easily create, deploy, and manage multiple independent websites within the same backend system.This means that, although all sites may share a set of core program code and template files, each of them has its own independent database, file storage directory, and crucialIndependent configuration information.

This architecture design greatly improves operational efficiency, avoiding the繁琐 of deploying and maintaining multiple systems.However, this combination of sharing and independence also requires us to strategically differentiate and call data during precision content operations, especially when working on highly customized SEO tasks like Json-LD.

Application and challenges of Json-LD in AnQiCMS

Json-LD is a lightweight data interchange format based on JSON, widely used to provide clear information about page content to search engines, such as the author of an article, publication date, product price, inventory, and even contact information for organizations.This is crucial for enhancing the display effect of the website in search results (such as rich media abstracts) and understanding.

In AnQiCMS, you can use custom tags{% jsonLd %}...{% endjsonLd %}Flexibly insert and control Json-LD data on the page.The strength of this tag lies in the fact that it not only allows you to embed any code that conforms to the JSON-LD syntax, but also can merge or override the default structured data generated by AnQiCMS.When you customize a field that conflicts with the default field, your custom settings will take precedence.

However, a careful operator may find that,jsonLdThe tag itself does not provide direct,siteIdParameters are used to distinguish data from different sites. This means that we cannot simply declare in Json-LD code that this is the data for Site A or this is the data for Site B.How should we solve this problem?

Core strategy: skillfully use the site-specific data tags of AnQiCMS

To solve the problem of data distinction under the multi-site mode of Json-LD, the key is to make full use of the characteristics of the AnQiCMS template engine:When rendering any page, AnQiCMS is clear about which site the current page belongs to.This makes it possible for us to dynamically obtain the data of the current site through other built-in tags with site differentiation capabilities and seamlessly inject it intojsonLdthe tag block.

AnQiCMS provides various powerful data tags, such as:

  • systemTags:Used to obtain the global configuration information of the current site, such as:SiteName(Website name),BaseUrl(Home page address),SiteLogo(Website Logo), etc.
  • contactTags:Used to obtain contact information for the current site, such asCellphone(Contact phone),Email(Contact email),Address(Contact address) and so on.
  • tdkTags:Used to obtain SEO meta information for the current page, such asTitle(Page title),Keywords(Page keywords),Description(Page description) and so on.
  • archiveDetail/categoryDetail/pageDetailTags: and so on.Used to obtain the detailed content of the current article, category, or single page, including title, description, images, and publishing time, and so on.

These tags will default to looking up data in the corresponding database and configuration of the current site when called. This means that as long as your template correctly uses these tags to retrieve information and place it injsonLdThe label block is inside, so the output Json-LD data is naturally the exclusive data of the current site.

Case study: Building Dynamic Json-LD

Let's look at a specific example to see how it works.Assume we want to generate a Json-LD structured data for each site targeting the "Organization" type as well as the "Article" type.

"`twig {# Retrieve some general information about the current site #} {% system siteName with name="SiteName" %} {% system baseUrl with name="BaseUrl" %} {% system siteLogo with name="SiteLogo" %} {% contact contactPhone with name="Cellphone" %} {% contact contactEmail with name="Email" %}

{# Dynamic generation of Json-LD based on page type #} {% ld %}