Schema.org doesn’t have to be complicated.
At the very core, schema.org is basically code that helps communicate to machines the relationship between facts and things.
Example:
Business name: Local SEO Group
Question: What is the email address for the Local SEO Group website?
Google is looking to provide certain information and understand certain relationships automatically.
However machines (aka Google) need it to be explicitly spelled out to them, because otherwise they would make mistakes.
So the way we do this, is using schema.org code on our website.
For this example I would use the “email” markup, which looks like this (in JSON LD form, we will come to that next):
“email”: “[email protected]”,
Types of Schema.org Code
The two most commonly used forms of schema.org code are categorised into JSON LD, and INLINE markup.
INLINE Schema.org
INLINE markup is code added in the area of the page where the information already exists. So in our email example above, we would find where the email address is mentioned on the page, and add the schema.org code around that email address.
JSON LD Schema.org
JSON LD code is not added in the content of the page, it’s added into the header code of the page, and is therefore invisible to users.
In our email example, we would add this into the header code as part of a parent topic (more on that next).
How to use Schema.org Code – The Rules
There are lots of different things that Google wants to understand, and so to categorise and organise these different elements, they have introduced what are called “types” as a way to label certain sets of information.
Certain characteristics have to be included under certain “types”, in order for them to be understood correctly.
These types include:
- Organization
- LocalBusiness
- ConsumerAction
- CreativeWork
- Diet
You can see a full list of the types available on the official website here: https://schema.org/docs/full.html
With our email example, there are certain categories where it wouldn’t make sense to use it under, for example “Diet”, but it would make sense to use it under “LocalBusiness”.
How to write JSON LD Schema.org
As Google prefers us to use the JSON LD form of schema.org, I will show you how to write custom code in this language.
For examples of writing inline schema.org, see the examples on the official website or Google for more information.
To start with, you need the basic structure of JSON LD schema.org code, and you can then add your individual elements into it.
Here is a basic example:
<script type=”application/ld+json”>{“@context”:”http://schema.org”,
“@type”:”Organization”,
“name”: “Local SEO Group”,
“email”: “[email protected]”
}</script>
I have separated this into lines with colour codes for easier comprehension below:
- Blue code – These are the “opening and closing” statements to tell Google where the schema.org code starts and finishes.
- Red code – this is the “type” described above, which categorises all of the information that will be within this JSON LD code.
- Orange code – this is an individually tagged piece of information within our parent topic.
- Green code – this is the final piece of information before the end of our code.
Important rules to note:
- Quote marks and colons: quote marks surround both the label and the information parts of a line, and a colon separates the two (directly after the label quote mark, with a space before the information quote mark). We can see in the example there is “name”: “Local SEO Group”,
- Comma after each line BUT NOT THE LAST LINE: you will see there is a comma after the type line, and after the name line, but the email line doesn’t have a final comma. This is because the last line before the closing tag must have it left off.
Now you have a basic structure, you can start to add more information in between the orange and green lines.
To find all the information you can include, visit the specific type page on the schema.org website, and look for all of the fields listed.
From our example, I can add our website, and logo to this really easily:
<script type=”application/ld+json”>{“@context”:”http://schema.org”,
“@type”:”Organization”,
“name”: “Local SEO Group”.
“url”: “https://localseo.group/”,
“logo”: “https://localseo.group/wp-content/uploads/2019/03/local-seo-group-logo-white-bg-1.png”,
“email”: “[email protected]”
}</script>
As you can see, all of the lines added have the same structure as the name line – “label”: “information”,
More Complicated Groups of Information – Adding Brackets
Sometimes you will notice that the labels call for more than 1 bit of information to be listed.
In these cases, we need to add extra brackets to include these extra bits of information within the same “parent label”.
One of the more common examples of this is the sameAs label, which is used to show other social profiles and websites associated with the brand.
Here is the general form that this will take when adding as an “orange” section from our example:
“sameAs”: [“website1.com”, “website2.com”, “website3.com”],
Note the form this takes, we have the same initial relationship with the first label – “sameAs”:
However next we have a square bracket, which opens the opportunity to add more than one item – [
Next we have the information, which comes in the form “info1”, “info2″,”infoLAST”
Notice how the final element within these brackets DOES NOT have a comma after it, which is the same as how the last line in the whole code doesn’t have a comma.
Then it finishes with a final square bracket and comma – ],
You can see this within our whole example code here:
<script type=”application/ld+json”>{“@context”:”http://schema.org”,
“@type”:”Organization”,
“name”: “Local SEO Group”,
“url”: “https://localseo.group/”,
“logo”: “https://localseo.group/wp-content/uploads/2019/03/local-seo-group-logo-white-bg-1.png”,
“sameAs”:[“https://website1.com”, “https://website2.com”, “https://website3.com”],
“email”: “[email protected]”
}</script>
How to Validate Your Code
So before you go crazy and add the new code into your site, you want to make sure Google can actually understand it.
Luckily they have provided a free tool to do this with.
All you do is visit the “Structured Data Testing Tool“, paste in your code, and click “Run Test”.
Google will then show you any warnings, or errors you code has, and you should use the advice above to find the error (it’s very easy to make mistakes writing this code!).
Final Thoughts and Help
There you have it!
You should now be able to write your own schema.org code to help Google understand your content better.
If you need help implementing these SEO tips, or want an ongoing service to better optimise your website, then send us an email [email protected]
Good luck with your SEO efforts!
This Post Has 0 Comments