How to dynamically reference the `contact` tag in Json-LD (such as phone, address)?

Calendar 👁️ 65

In today's highly competitive online environment, every detail of a website can affect its performance in search engines.As an experienced website operation expert, I fully understand the key role played by structured data (Structured Data) in improving website visibility, and Json-LD, as the format recommended by search engines like Google, is even more crucial.For corporate websites in particular, how to accurately and dynamically display a company's contact information to search engines, such as phone numbers and addresses, not only enhances local search visibility but also greatly improves user trust.

Today, we will delve deeply into how to cleverly reference the background in Json-LD in AnQiCMS (AnQi CMS)contactThe contact information configured in the label. AnQiCMS provides great convenience for content operation with its efficient, customizable features, and this dynamic reference mechanism is a reflection of its flexibility.

Json-LD and contact information: the foundation of enhancing website credibility

Let's briefly review the importance of Json-LD.It is a data format based on JSON that allows webmasters to embed structured data directly into web pages.This data is not visible to users but can be understood by search engine robots, thus helping search engines better interpret web content.

For businesses, presenting core contact information (such as company name, phone number, physical address, business hours, etc.) in the form of Json-LD is an effective way to build a digital identity for the company.This not only helps search engines display richer snippets in search results, such as displaying company phone numbers or map information, but also subtly conveys the professionalism and reliability of the company.Imagine if users can directly see your company's phone number and address in search results, wouldn't it be easier for them to click and contact you?

How does AnQiCMS manage your enterprise contact information?

AnQiCMS understands the importance of enterprise contact information management and therefore provides a "Contact Information Settings" function in the background. Here, you can centrally configure the various contact information of the company, such as:

  • Contact (UserName)
  • Contact Phone (Cellphone)
  • Contact Address (Address)
  • Contact Email (Email)
  • WeChat (Wechat) and WeChat QR code (Qrcode)
  • and various social media links (such as WhatsApp, Facebook, Twitter, etc.)

Even, AnQiCMS also allows you to customize more contact information fields according to your business needs. Once these pieces of information are configured in the background, they can be flexibly called in the front-end pages through AnQiCMS's powerful template tag system, and the most commonly used one iscontactLabel. For example, you can{% contact with name="Cellphone" %}to directly obtain the phone number set in the background.

Core issue: How to dynamically reference these contact methods in Json-LD?

Now, the key question is: We already know how to manage contact information centrally in the AnQiCMS backend, and we also know how tocontactHow to seamlessly integrate these dynamic data into the Json-LD structured data without manually modifying the Json-LD code each time you change the phone number or address?

Maintaining Json-LD manually is not only inefficient but also prone to errors, especially when managing multiple sites or frequently updating contact information.The advantage of AnQiCMS lies in the flexibility of its templates, which is enough to meet this need.

Solution:jsonLdwith the tag andcontactcombine tags beautifully

AnQiCMS provides a namedjsonLdThe dedicated tag that allows you to customize the Json-LD content of the page. The core of solving dynamic reference contact methods is right herejsonLdInside the tag, using AnQiCMS template syntax, combiningcontacttags to retrieve the data configured in the background.

jsonLdThe usage of the tag is relatively intuitive, it acts as a block-level tag where you can write JSON code that conforms to the Json-LD specification. AnQiCMS will intelligently process this content and output it to the page.<head>Area (usually).

Here is a specific code example demonstrating how to dynamically reference the background configuration contact information in Json-LD:

{% jsonLd %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "LocalBusiness",
  "name": "{% system with name='SiteName' %}",
  "image": "{% system with name='SiteLogo' %}",
  "telephone": "{% contact with name='Cellphone' %}",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "{% contact with name='Address' %}",
    "addressLocality": "您的城市", {# 假设城市信息需要单独填写或从其他地方获取 #}
    "addressRegion": "您的省份", {# 假设省份信息需要单独填写或从其他地方获取 #}
    "postalCode": "100000", {# 假设邮政编码需要单独填写或从其他地方获取 #}
    "addressCountry": "CN"
  },
  "url": "{% system with name='BaseUrl' %}",
  "openingHours": "Mo,Tu,We,Th,Fr 09:00-18:00", {# 假设营业时间需要单独填写 #}
  "contactPoint": {
    "@type": "ContactPoint",
    "telephone": "{% contact with name='Cellphone' %}",
    "contactType": "customer service"
  }
}
</script>
{% endjsonLd %}

Code analysis and practical tips:

  1. {% jsonLd %}...{% endjsonLd %}This is the Json-LD custom tag block provided by AnQiCMS, all your custom Json-LD content should be placed here.
  2. @contextand@typeThis is the foundation of Json-LD,@contextdefines the vocabulary of data semantics (usually Schema.org),@typethen indicates the type of entity you are describing, for example,LocalBusinessOr (local business) typeOrganization(Organization).
  3. "name": "{% system with name='SiteName' %}"Here we not only refer to the contact information, but also dynamically refer to the website name (SiteName) and website logo (SiteLogo) configured in the background "Global Function Settings" as the enterprise name.This demonstrates the collaborative ability of AnQiCMS tags.
  4. "telephone": "{% contact with name='Cellphone' %}": This is the core! We go directly through.contactthe tag, toname='Cellphone'The parameter dynamically retrieves the phone number configured in the background "Contact Settings".If the phone number is updated, you only need to modify it once in the background, and all Json-LD structured data referencing the label will be automatically updated.
  5. "address": {...}: Similarly, we go through.{% contact with name='Address' %}Dynamically obtained the detailed address of the company. Please note, Schema.org'sPostalAddressThe type requires more detailed address segmentation (such as street, city, province, postal code, country), if your backend only provides a complete address, you may need to manually split it, or add more detailed address fields in the backend for this call.
  6. |safeFilterIn some cases, when Json-LD content contains special characters or HTML entities, the AnQiCMS template engine may automatically escape them to ensure security. AlthoughjsonLdThe tag usually contains built-in processing, but if you encounter Json-LD parsing errors, you can try adding it after dynamic content output|safeFilter, for example{{ someVar|safe }}Ensure that the content is output as is without escaping. However, for Json-LD which is a plain text JSON format, this is usually not necessary|safe.

Operation steps and precautions:

  1. The background configuration is completeEnsure that the relevant information in the "Contact Information Settings" and "Global Function Settings" of AnQiCMS background is filled in completely and accurately.
  2. Select the template fileAdd the above Json-LD code to the public header file of your website template (for examplebase.htmlorheader.htmlusually before the<head>Inside the label,</head>tag), so that it can take effect on all pages.
  3. Json-LD validationAfter adding the code, be sure to use the Google Structured Data Testing Tool or the Rich Results Test to verify your webpage.This can help you check for syntax errors in Json-LD code, as well as whether search engines can correctly parse your data.
  4. Adjust as needed: In the exampleLocalBusinessType is just one of them, you can adjust according to your business type (such asOrganization/Restaurant/ServiceChoose a more appropriate Schema.org type, and supplement more related fields, such as business hours (openingHours), price range (priceRange), geographic coordinates (geoThese information can also be obtained through backend custom fields andcontacttags orsystemdynamic tags.

Summary

AnQiCMS provides a powerful and flexible template system that allows website operators to easily manage content and optimize SEO. By cleverly combiningjsonLdwith the tag andcontactas well assystemThe label, we can not only achieve the dynamic reference of contact information, but also ensure that the structured data of the website is always synchronized with the background configuration, greatly improving the operation efficiency and the search engine friendliness of the website.This 'one-time configuration, use anywhere' strategy is exactly the embodiment of AnQiCMS in helping small and medium-sized enterprises and content operation teams improve their competitiveness.

Frequently Asked Questions (FAQ)

Q1: Can reference in Json-LD?systemInformation such as the website name or Logo configured in the tag?A1: Absolutely. As shown in the article example, you can use{% system with name='SiteName' %}Dynamically obtain the website name or use{% system with name='SiteLogo' %}Get the website logo address. AnQiCMS'ssystemThe label can call all the configuration items in the background "Global Function Settings" to keep the basic site information in Json-LD dynamicly updated.

Q2: What will be displayed in Json-LD if I have not configured a contact method in the background (for example, if I have not filled in WhatsApp)?A2: If a contact information field in the background is empty, thencontactThe output at this location will also be an empty string. In Json-LD, this is typically represented by the field having an empty string value (for example"telephone": ""This will not cause a Json-LD parsing error, but it is recommended to fill in as much information as possible in the background, or add conditional judgment in the template, if a field is empty, do not output the Json-LD attribute to maintain the simplicity and validity of Json-LD.

Q3: BesidesOrganizationorLocalBusinessWhat are the Json-LD types that can be applied to this dynamic reference method?A3: This dynamic reference method is applicable to all Json-LD types that need to include contact information (or any other information that can be obtained through AnQiCMS tags). For example, inArticleIn the (article) type, you can dynamically refer topublisher(Publisher)'snameandlogo; inProductIn the (product) type, you can refer toseller(Seller)'s contact information. The core principles are injsonLdWithin the tag, use the AnQiCMS template syntax (such ascontact/systemand tags) to dynamically fill in the corresponding Json-LD attribute values.

Related articles

How to create a `Product` type Json-LD structured data for AnQiCMS product detail page?

AnQiCMS (AnQiCMS) is an efficient enterprise-level content management system that not only provides powerful content publishing and management functions, but also has done a lot of work in SEO optimization.For e-commerce websites or businesses with product display needs, how to make search engines better understand and display your products, and achieve higher click-through rates and conversion rates, is the key to operating success.In this, Json-LD structured data, especially the `Product` type, plays an indispensable role.

2025-11-06

Does the Json-LD custom tag support dynamic retrieval of the website name and Logo from the `system` tag?

As an experienced website operations expert, I fully understand the importance of search engine optimization (SEO) in today's context, and structured data, especially Json-LD, is undoubtedly the key to improving the understandability and search ranking visibility of website content.Today, let's delve deeply into a common issue encountered by AnQiCMS (AnQiCMS) users: **Does the Json-LD custom tag support dynamic retrieval of the website name and Logo from the `system` tag?

2025-11-06

How to integrate the page's SEO title, keywords, and description into Json-LD using the `tdk` tag of AnQiCMS?

In today's highly competitive internet environment, Search Engine Optimization (SEO) is no longer an optional choice, but the foundation of website success.For systems like AnQiCMS, which are specifically designed for enterprise-level content management and SEO optimization, the various tools provided are aimed at helping operators stand out in search results.

2025-11-06

How to add multiple image URLs in Json-LD, such as the thumbnail list of an article?

As an experienced website operation expert, I am more than happy to give you a detailed explanation of how to cleverly integrate the URLs of multiple thumbnails of articles into Json-LD data in AnQiCMS, thereby enhancing the website's search engine performance and user experience. --- ## How to skillfully use AnQiCMS: Efficiently integrate multiple image URLs in Json-LD to enhance the visual appeal and search engine performance of articles In today's increasingly fierce content marketing environment, how to make search engines better understand and display your content is crucial.

2025-11-06

How to verify the validity of the Json-LD structured data generated or customized by AnQiCMS?

In today's highly competitive online environment, it is particularly important to ensure that search engines better understand your website content, so that it stands out in search results.And JSON-LD structured data is the key tool for achieving this goal.AnQiCMS is an efficient and customizable enterprise-level content management system, naturally also understands this, and provides the function of generating and customizing Json-LD structured data.But generating is not enough, how to ensure that these data are correctly parsed and effectively utilized by search engines has become a problem that website operators must pay attention to.

2025-11-06

What is the specific impact of Json-LD structured data on the search engine ranking of AnQiCMS website?

In today's highly competitive digital environment, the search engine ranking of a website directly determines its visibility and the ability to reach potential customers.For AnQiCMS and similar content management systems aimed at providing efficient solutions for small and medium-sized enterprises and content operation teams, how to better optimize SEO performance is their core value.Among them, the Json-LD structured data plays a vital role.How exactly does Json-LD affect the search engine ranking of AnQiCMS website?

2025-11-06

Does AnQiCMS provide tools or tips to help users write JSON-LD that complies with Schema.org specifications?

As an experienced website operations expert, I am well aware of the core position of structured data in modern search engine optimization (SEO).Schema.org JSON-LD not only helps search engines understand web content more accurately, but also helps websites gain richer search results display (such as rich media abstracts), thereby improving click-through rates and traffic.In regards to whether AnQiCMS provides tools or hints to help users write Json-LD that complies with Schema.org standards?

2025-11-06

How to add the `FAQPage` Schema type required for the FAQ page in Json-LD?

As an experienced website operations expert, I am happy to give you a detailed explanation of how to add `FAQPage` Schema type to the FAQ page in AnQiCMS.AnQi CMS offers great convenience for content operation with its concise and efficient architecture and powerful SEO tools.

2025-11-06