Adding Local business schema to your locations

With organic search, there are several reasons why having a proper and thorough schema applied to your website is an advantage. Schema helps search crawlers do their job more effectively by helping them comprehend a landing page and delivering relevant information on the search engine results page.

Terms to know

Schema - Schema is a shared language created by search engines, containing a standard markup for structured data search engines are able to understand.

Structured data - Where Schema is the language in which you present your content, structured data is the actual data you provide.

Rich results - By providing structured data using Schema, search engines will know exactly what users can find on your page and what it all means.

Rich results with Local business schema 

When users search for businesses on Google Search or Maps, Search results may display a prominent Google knowledge panel with details about a business that matched the query. When users query for a type of business (for example, "best NYC restaurants"), they may see a carousel of businesses related to the query. With Local Business structured data, you can tell Google about your business hours, different departments within a business, reviews for your business, and more.

You can find out more from Google about structured data for local businesses

Adding Local business schema to your theme

To add the schema to your theme, copy and paste the following code and place it at the bottom of your locations template. 

Validate your code using the Rich Results Test.

You can also customize the code below to add other properties, your custom fields, and change the type of location. You can find the full definitions at schema.org/LocalBusiness.

{% comment %}
Local Business Schema
https://developers.google.com/search/docs/advanced/structured-data/local-business#structured-data-type-definitions
Use custom fields to add your own data. e.g priceRange, acceptsReservations, sameas.
{% endcomment %}
<script type="application/ld+json">
 {
   "@context": "https://schema.org",
   "@type": "LocalBusiness",
   {% if location.image_url %}
   "image": "{{location.image_url}}",
   {% endif %}
   "name": "{{location.name}}",
   "address": {
     "@type": "PostalAddress",
     {% if location.address_line_1 %}"streetAddress": "{{location.address_line_1}}
     {% if location.address_line_2 %}, {{location.address_line_2}}{% endif %}",{% endif %}
     {% if location.city.name %}"addressLocality": "{{location.city.name}}",{% endif %}
     {% if location.region.name %}"addressRegion": "{{location.region.name}}",{% endif %}
     {% if location.postal_zip_code %}"postalCode": "{{location.postal_zip_code}}",{% endif %}
     {% if location.country.name %}"addressCountry": "{{location.country.name}}"{% endif %}
   },
   "geo": {
     "@type": "GeoCoordinates",
     "latitude": {{location.lat}},
     "longitude": {{location.lng}}
   },
   "url": "{{location.url}}",
   {% if location.phone_number %}
   "telephone": "{{location.phone_number}}",
   {% endif %}
   {% if location.email %}
   "email": "{{location.email}}",
   {% endif %}
  {% if location.opening_hours %}
     "openingHoursSpecification": [
     {% for opening_hour in location.opening_hours %}
     {
       "@type": "OpeningHoursSpecification",
       "dayOfWeek": "{{opening_hour.day}}",
       {% if opening_hour.status == "open" %}
       "opens": "{{opening_hour.opening_time | date: "%H:%M"}}",
       "closes": "{{opening_hour.closing_time | date: "%H:%M"}}"
       {% elsif opening_hour.status == "24h" %}
       "opens": "00:00",
       "closes": "23:59"
       {% elsif opening_hour.status == "closed" %}
       "opens": "00:00",
       "closes": "00:00"
       {% endif %}
     }
     {% unless forloop.last %},{% endunless %}
     {% endfor %}
     ]
   {% endif %}
 }
 </script>
	
Was this page helpful? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Contact