• Home
  • Blog
  • How to Use ChatGPT to Write Schema Markup in JSON-LD
Digital Marketing

How to Use ChatGPT to Write Schema Markup in JSON-LD

26 April 2023

You’ve probably heard a lot of talk about schema markup and how it can improve your website’s ability to rank well on the search engine results page (SERP). But identifying – and especially writing – schema markup isn’t an easy task. One misplaced comma, a missing bracket, or stylized quotation marks will invalidate your schema, rendering it useless.

With the advent of ChatGPT, simple coding mistakes in schema markup are a thing of the past.

In this blog, we’ll discuss how to use ChatGPT to identify potential schema markup opportunities, how to use it to write schema markup for you, and what to be aware of when utilizing this powerful AI tool.

What is Schema Markup (and why is it important)?

Schema markup is a type of code that you can add to your website's HTML to help search engines understand the content on your pages. It informs search engines about what your content is trying to convey on a web page and converts unstructured data into structured data. The most widely used and supported schema markup encoding language is JSON-LD, which is what we will be using in our examples.

Schema markup also can enhance the appearance of your web pages in search results. Not all types of schema markup will result in a rich snippet, but there are certain types of schema markup that can.

Adding schema markup to your website doesn’t have a direct impact on your ranking. In other words, it isn’t part of Google’s ranking algorithm – yet. However, adding schema markup does have an indirect impact on the ranking ability of web pages, because it provides search engines like Google with better semantic meaning of your website’s content and helps improve crawlability.

Using ChatGPT to Identify Schema Markup Opportunities

Before you can use ChatGPT to write schema markup, you have to know what types would be appropriate for your website. It’s important to note that ChatGPT can provide guidance on this, but that you should always consult an SEO expert to verify the validity and accuracy of ChatGPT’s choices.

For example, ChatGPT might recommend a type of schema markup that is outdated or not widely used anymore. For example, it could recommend that you use Professional Service schema markup, which has been deprecated by Google, but will never be removed from Schema.org’s library.

An SEO expert keeps up with the most current and correct information and would know that the correct and most current type of schema for marking up a service page is Service schema markup.

That being said, let’s go through the steps for using ChatGPT to identify the best types of schema markup for a website:

Steps to Identify Schema Markup Opportunities Using ChatGPT

  1. Open ChatGPT and sign into your account. If you haven’t already created an account, you will need to do so to use it.
  2. Copy the URL of your website so it’s ready to paste into the ChatGPT prompt.
  3. Ask ChatGPT to identify the most appropriate types of schema markup for your website based on its content, being sure to paste in your website’s URL. Check out the example below:
Screenshot from ChatGPT asking it to recommend schema markup types for Sagepath website
Screenshot of ChatGPT answer providing a list of five applicable schema types.

As you can see, ChatGPT was able to identify the most appropriate types of schema markup to use on our old website. As an SEO expert, I completely agree with these suggestions. But one downfall is that ChatGPT didn’t recommend adding Service schema markup, which would have been a great suggestion, as Sagepath does offer a handful of services.

ChatGPT might not always provide a complete list, and could potentially provide schema types that are outdated, so it’s always best to consult with an SEO expert to get their final approval and identify any types of schema opportunities that the AI tool might have missed. For a full list of available schema types, visit https://schema.org

How to Use ChatGPT to Generate Schema Markup

Now that we have our list schema markup list, it’s time to start the real fun – asking ChatGPT to write the markup for us.

Before we dive in, there are a few things to consider that require an SEO expert’s evaluation:

  • What pages should the markup be placed on? For example, you don’t need to include Organization schema markup on every page, but you should include WebPage schema markup on every page.
  • What fields are required for the schema markup to function properly, and which fields are optional?
  • Will the schema markup be considered spammy and result in a manual action (penalty) from Google?

As we mentioned earlier, JSON-LD is the most widely accepted encoding language – and ChatGPT knows this! However, there can be some instances where it doesn’t write schema in JSON-LD, so it’s important to specify to write the script in JSON-LD to be sure.

Using the example above, we asked ChatGPT to write Organization schema markup. Since AI can learn from previous prompts, it’s important to continue your “conversation” with ChatGPT in the same window.

Screenshot from ChatGPT asking it to write organization schema for Sagepath website.
Screenshot of ChatGPT response showing JSON-LD encoded schema markup using placeholders.

As you can see from the screen shot above, ChatGPT generated an example of Organization Schema Markup that can be used on the website.

But there are some issues.

ChatGPT didn’t pull in the correct data that clearly appears on the website. Here are the fields that it provided incorrect information for:

  • logo – The logo URL used in this schema markup does not match the actual URL of the Sagepath logo.
  • description – Despite having a meta description for the Sagepath.com homepage, ChatGPT rewrote it using placeholder copy.
  • address (all fields except “addressCountry”) - The Sagepath location is clearly written out in the footer and is also available on our Google Business Profile, yet ChatGPT used placeholder information for all fields in the “address” entity.
  • contactPoint “telephone” and contactType – As a digital marketing agency, “sales” or “general inquiries” would have been a better choice for the contactType field. ChatGPT used a placeholder for the telephone field.
  • sameAs LinkedIn profile URL – ChatGPT populated its “best guess”
  • Only provided three “sameAs” entities, despite the website clearly linking out to five different social media profiles.

Because of issues like this, it’s important to use ChatGPT to write a basic template that you can use to then populate the fields with the correct information. You should never rely on it to add the correct information.

Validating Your Schema Markup

The next step is to copy the code and run it through two different structured data testing tools. In your open conversation with ChatGPT, locate the “Copy Code” button in the top right corner. Click it to copy the code so it’s ready to paste into the structured data testing tools.

Despite the use of placeholders by ChatGPT, the schema validates properly when tested through both the Schema Markup Validator and Rich Results Test tools.

  1. Schema Markup Validator : Copy the code into this tool to identify any issues that might cause it not to work. It will identify the issue and show you the line of code where the issue lives, but only an experienced SEO expert can truly understand the results and correct any issues. The screenshot below shows that the code is valid and there are no issues.

    Screenshot from Schema validation tool showing markup passed validation.
  2. Rich Results Test : This tool will identify if there are any missing fields, whether or not those fields are required, and will identify the elements of the code that could result in a rich snippet. Running the code through this tool showed that there are no missing fields, and that the logo could potentially result in a rich snippet that includes the Sagepath logo on SERPs.

    Screenshot from Rich Results Test tool showing organization markup was valid.

Wrapping It Up

Using ChatGPT to write schema can be incredibly helpful for people who don’t know how to code in JSON-LD. It makes it easy to identify specific types of structured data to use on your website, and to generate a usable template that passes validation.

However, it’s always best to consult a Search Engine Optimization expert to help you understand where to place the code, how to properly implement it, ensure the data provided aligns with the information available on your website, and to identify any structured data opportunities it might have missed.

Connect With a Structured Data Expert

Do you need help writing, validating and implementing schema markup on your website? The SEO experts at Sagepath Reply can help! Contact us today to discuss the best opportunities for your website to help increase organic visibility, drive more organic traffic and increase click-through rates.

About The Author:

Dylan Goldman, Sr. SEO & Web Content Manager | Sagepath Reply

Dylan is a search engine optimization and web content expert with over 15 years of experience successfully optimizing websites to increase their organic visibility and drive organic traffic. Dylan has extensive experience writing and implementing schema for businesses across multiple industries, including ecommerce, financial institutions, software and tech companies, retailers, and more.

Sources:

Let’s Start a Conversation

Let’s Start a Conversation

Reach out to discuss your digital transformation needs and see how we can help. We would love to start a long-term partnership with your company.

Get in Touch