The local_business model should be used when defining sites associated with a business having one or more locations that are open to the public. Such a business will also generally have one or more Google My Business listings and the information entered into the local_business model will be similar to what is shown in these listings. The local_business model serves two main purposes:
Defining the Local Business Values
The first set of values reflects content that relates to the business as a whole (as opposed to the individual locations). If there is a master email and phone number these would be entered here.
Notice that our featured business (to the right) is a Carpet Cleaning business. Such a business type is not defined by schema.org so we need to assign the business type to the closest match. In this case we have selected Home and Construction Business - General. Schema.org allows for an additionalType which coincides with the last portion of the Wikipedia url (after wiki/) that better describes the type of business or service. In this case, the Wikipedia page is https://en.wikipedia.org/wiki/Carpet_cleaning so we have entered Carpet_cleaning as the Wikipedia Subtype value.
If you want to include the hours of operation use the weekly_schedule model to define these. If these are standard weekday hours such as 9 AM - 5 PM you can include one of the weekly schedules defined in system. If the hours differ by location, you can enter the most common hours as the default schedule and override this at the location level for locations whose hours differ.
Department Contact Information
If entered, this will be used to generate contactPoints. If your business has separate public phone numbers or email addresses for different departments you can enter these here.
There should be one row in this section for each Google My Business listing associated with the company. If there are separate local phone numbers and email addresses for each location enter these here. Otherwise, leave these blank and they will default to the ones specified in the main fields.
In order to obtain the lat/long of the address you can search for the address in Google Maps and the resulting url should contain the lat/long.
Social Media Links
Define all of the external site pages that are associated with this business. This is used to generate the sameAs tags in the schema and also can be used to generate social media links.
Add any necessary rows to select all of the payment types that apply.
Stowing the local_business Specification
When stowing this specification, you should leave the name empty and it will default to mybusiness.
Adding Local Business Data to Your Website
Generally speaking you should have a dedicated page on your website for each business location. This page will generate the json script to describe that location. For businesses with multiple locations, you may have a page on the website that shows all locations. In this case, you can define an organizational schema that would show all location addresses.
Creating an Address Template
An address template is similar to other page sections except that it contains placeholders instead of actual address values. For basic address content, you can use the following template from system called local_business/simple-name-addr-phone.
Notice that templates may include $function references however, such references must use the word DOLLAR (in upper case) rather than the $ symbol. The following placeholders can be used within the template.
These will be taken from the main business values:
These placeholders will be substituted for values taken from a specific location:
:css_class: can also be referenced in the template and can be substituted for a class value.
To render the template with the local_business values substituted we use the $local_business function. Here is an example of how this is called:
Let's review the parameters passed to this function.
json Script Flags
As per Google's recommendations, you should not generate json schema definitions for content that does not appear on the page. For example, you may have defined a weekly hours schedule for your local business. However, if the page for which you are generating a schema does not show these hours, Google states that you should not incorporate the hours into the json schema for the page. Therefore, the purpose of these flags is to control which portions of the schema get generated so that you can align the json schema with the visual content of the page. Here is a summary of the flags that are available:
Controls the generation of contactPoints into the schema.
Controls the generation of the paymentAccepted definition.
Controls the generation of areaServed definition.
Controls the generation of schedule of openingHours.
Asterisk is a special flag that is used to indicate that you would like all locations to be generated into the schema. Recall that we recommend having a separate page for each location and only generating json for the current location. Nevertheless, it is possible to define a page that shows all locations together. For such a page, you can use * in the flag column (as well as the other desired flags) to request that json schema be generated for all locations. This will set up a separate Organization structure and place the locations under the location. The division names specified for each location will be added to the end of the main business name.
If none of the above flags apply, set the flag value to "1" (the number one) to trigger the generation of the basic address information for one location.
Consider the following location definitions:
Notice there are two locations.
Rendering One Location On the Page
If we want to build a page that shows the chatham location and also generates a json schema for this location which includes the hours and the area served we can code the following dollar function:
This will generate the following content onto the page:
This function will also add the following json schema to the page:
Rendering Multiple Locations
Let's assume that the page you are creating needs to show all locations and you want to reflect this in the json schema. You would need to define a separate $local_business function for each location as shown here:
Please make note of the following:
Here we can see that both addresses have been generated using the same template:
And the following schema has also been generated:
Accessing Individual Local Data Fields
Individual elements of the local_business definition can be accessed using the $object function. For scalar fields the format of this function is:
For example: $object(mybusiness,business_name)
Other scalar fields include
It is also possible to access address fields by passing parameters in the following pattern:
For example $object(mybusiness,location,windsor,street)
Using this pattern the following field-names are supported:
You can also use this method to return the combined address formatted on several lines using the function:
By default, the P.O. Box (if entered) is not included in the formatted address. Nevertheless, this can be requested by passing a fourth parameter. Pass 1 to show the P.O. Box on row 1 of the address, pass 2 to show the P.O. Box on row 2 (after the street). For example, this will add the P.O. Box on line 2 (only if there is a P.O. Box entered for the address)
Joining Several Local Business Fields
A final method of retrieving local business values is to use this format:
In this case, the values can either be field references or constants. For example:
$object(mybusiness,join,windsor,<b>,business_name,</b><br />,street,<br />,city, ,region,<br />,postal_code,<br /><br />Phone: ,local_telephone)
Will render the following html:
Which will appear as this: