What is JSON-LD Schema Markup?

In this tutorial, we will learn how to add JSON-LD structured data for a restaurant to your website. Implementing schema markup helps search engines understand your content better, which can enhance your search result listings with rich snippets.

What is JSON-LD Schema Markup?

JSON-LD (JavaScript Object Notation for Linked Data) is a method of encoding linked data using JSON. It is recommended by Google for adding structured data to your site because it is easy to implement and maintain.

Why Use Restaurant Schema?

Adding restaurant schema provides search engines with detailed information about your restaurant, such as name, address, opening hours, menu, and contact details. This can lead to enhanced search listings, including star ratings, price ranges, and more.

Step-by-Step Guide to Adding JSON-LD Restaurant Schema

1. Prepare Your Restaurant Data

Gather all relevant information about your restaurant, including:

  • Name of the restaurant
  • Address and contact details
  • Opening hours
  • Menu URL or details
  • Price range
  • Aggregate rating (if available)

2. Create the JSON-LD Script

Use the following template and replace the placeholder data with your actual restaurant information:

Example:

{
  "@context": "https://schema.org",
  "@type": "Restaurant",
  "name": "Sample Restaurant",
  "image": "https://www.example.com/images/restaurant.jpg",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "123 Main St",
    "addressLocality": "City",
    "addressRegion": "State",
    "postalCode": "12345",
    "addressCountry": "Country"
  },
  "telephone": "+1-234-567-8900",
  "url": "https://www.example.com",
  "openingHours": [
    "Mo-Sa 11:00-22:00",
    "Su 12:00-20:00"
  ],
  "menu": "https://www.example.com/menu",
  "priceRange": "$$",
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.5",
    "reviewCount": "124"
  }
}

3. Embed the Script into Your Web Page

Insert the JSON-LD script into the <head> section of your webpage. If you are using WordPress, you can add it via a custom plugin, theme functions.php, or using a plugin like “Insert Headers and Footers”.

Example code to add:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Restaurant",
  "name": "Sample Restaurant",
  "image": "https://www.example.com/images/restaurant.jpg",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "123 Main St",
    "addressLocality": "City",
    "addressRegion": "State",
    "postalCode": "12345",
    "addressCountry": "Country"
  },
  "telephone": "+1-234-567-8900",
  "url": "https://www.example.com",
  "openingHours": [
    "Mo-Sa 11:00-22:00",
    "Su 12:00-20:00"
  ],
  "menu": "https://www.example.com/menu",
  "priceRange": "$$",
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.5",
    "reviewCount": "124"
  }
}
</script>

Verifying Your Schema Markup

After adding the JSON-LD script, use Google’s Rich Results Test tool (https://search.google.com/test/rich-results) to verify that your schema markup is correctly implemented and recognized.

Conclusion

Implementing JSON-LD restaurant schema is a straightforward way to improve your website’s visibility and attractiveness in search results. Regularly update your schema data to ensure accuracy and maximize the benefits of rich snippets.