Adding structured data like JSON-LD to your blog or website is a very important search engine optimization (SEO) technique. It helps Google to understand your content better and helps your website to get a better search ranking.
What is Structured Data
Structured data is a standard format to add information to a page which can be easily understood by search engines to identify the content of the page. For example, if you have a cooking blog, Google needs to understand if a particular page is for recipe and if yes, it needs to extract key information from that page to match with the user query. Structured data helps Google by directly providing this information.
Structured data is comprised of predefined properties which are based on schema.org.
There are multiple formats to add structured data to your website. The three most popular formats which are supported by Google are-
-
JSON-LD
This is a subset of JSON where all the properties are defined in the head section of an HTML page. -
Microdata
In the Microdata format, structured data properties are nested within HTML content by using HTML tag attributes. -
RDFa
Similar to Microdata, RDFa uses HTML tag attributes which are officially HTML5 extension.
Out of these three, Google recommends using JSON-LD for structured data whenever possible.
So, our focus in this post will be only on JSON-LD. There is no use to add multiple structured data formats. One structured data format implemented efficiently is enough for Google to understand the key information provided by our content.
JSON-LD is the easiest to implement among all other structured data formats as it is consolidated at a single place in the head section. Also, the JSON structure is easy to create either manually or through programming making it very fast to implement. The cluttered approach of Microdata & RDFa is something which actually results in errors in implementing structured data. JSON-LD is free from all that mess.
The content on internet is mainly written in the form of blogs containing a lot of blog posts. So, in this article, I will tell you how to implement JSON-LD for a blog post.
Though, schema.org provides a large number of properties for each page type, it is not necessary for you to implement all those properties. A few important ones are enough.
Implementation of JSON-LD in a Blog Post
First of all, let’s take a look at the complete JSON-LD snippet to be added to the head section of a blog post. Then, I will explain each property. Most of the properties are self explanatory.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "Enable browser caching on Apache server using htaccess",
"description": "Browser caching for all types of files can be easily done using Apache's .htaccess file. This simple configuration results in a faster website, less consumption of bandwidth and better user experience.",
"mainEntityOfPage": "https://webrosis.com/enable-browser-caching-apache-server-htaccess",
"image": "https://webrosis.com/assets/images/logo.jpg",
"datePublished": "2019-08-06",
"dateModified": "2019-08-06",
"author": {
"@type": "Person",
"name": "Abhineet Mittal",
"description": "Abhineet is IIM Alumnus and Founder of popular Digital Publishing Platform, Sahityapedia. He is a technology enthusiast by hobby & an avid reader.",
"image": "https://webrosis.com/assets/images/logo.jpg",
"url": "https://webrosis.com/about"
},
"publisher": {
"@type": "Organization",
"name": "Webrosis.com",
"logo": {
"@type": "ImageObject",
"url": "https://webrosis.com/assets/images/logo.jpg"
}
}
}
<script>
In this code, I have taken JSON-LD from one of the blog posts of this blog. Let’s discuss each element used in this code.
- The entire JSON-LD snippet has to be wrapped inside
<script type="application/ld+json">
and</script>
tags. - @context is standard and should be used as-is.
- The most relevant type for a blog post in schema.org is BlogPosting. So, we will use that for @type.
- Headline is the page title. This title will be visible on the Google search results page.
- Description is a short summary of the page, and like Heading, it will be visible on the Google search results page.
- mainEntityOfPage defines that the topic discussed is the primary topic for this page. That means it has to have canonical URL.
- Image is URL to featured post or thumbnail of this post.
- datePublished & dateModified are self-explanatory.
- Author adds nested properties to define a Person. Add your name, description (biography), image and URL.
- Finally, Publisher is similar to Author, but it indicates an organization and must have name and logo properties.
Interestingly, according to schema.org, Publisher can be either Person or Organization. But Google only accepts Organization as a Publisher. So, do not use Person there.
Finally, you can validate your schema using Google Structured Data Testing Tool. If you see any error, try to fix it based on the comments provided by Google.
And that’s it. Your blog posts are now SEO ready which can be easily understood by Google.
Make sure you do not stuff structured data with unrelated content. Structured data should clearly describe the actual content in the blog post. Doing otherwise, will hurt your search ranking as Google’s algorithm’s are smart enough to notice any discrepancies.
When all this is done, wait for a few days and observe the change in your search rankings. Properly implemented structured data will definitely boost the search ranking of your blog bringing in more traffic.