Schema markup can tell search engines whether a page is about a person, place, product, or several other classes. Web pages with schema markup are distinctive in search results. They often lead to higher clickthrough rates than competing pages.
In this article, we’ll show you how to add schema markup manually. While it’s not the quickest method, this approach gives you more control and prevents you from having to install any extra plugins.
1. Choose Your Preferred Format
There are several different formats that you can use to mark up your website content. The most common are Microdata, RDFa, and JSON-LD.
Microdata
Microdata is a set of tags that you can use to add structured data directly to HTML elements. Adding these tags to your HTML makes them more machine-readable and accessible to search engines and web crawlers.
Each set of Microdata tags consists of an itemscope, an itemtype, and itemprops. This combination helps to identify the tagged item and outline its properties.
RDFa
RDFa is short for Resource Description Framework in Attributes. Just like Microdata, RDFa adds tags to HTML elements to make them more machine-readable. This framework has three tags: vocab, typeof, and property. These help to outline the vocabulary in use, the page type, and its properties.
JSON-LD
JSON-LD stands for JavaScript Object Notation for Linked Data. It is Google’s recommended format for schema markup. Unlike the other formats discussed, JSON-LD is not an inline method. This means you don’t need to make direct changes to HTML elements. Instead, you embed the code in the header of your webpage. This is generally easier to implement.
2. Write the Markup in a Text Editor or Use a Schema Markup Generator
Once you’ve chosen your preferred schema vocabulary, it’s time to move on to writing the HTML to create your markup. More experienced coders can go ahead and create this using any of the best free code editors.
The easier way is to use a Schema Markup Generator, which will automatically generate the code for you. There are lots of generators out there but two of the best ones are Schema Markup Generator by Merkle and JSON-LD Generator by Hall Analysis.
Both of these tools offer a wide range of schema vocabularies for you to choose from. All you have to do is select one and fill in the required data. The tool will then generate the appropriate code for you. You can then copy the code snippet to use on your website.
3. Add the Markup to the Desired Webpage
Adding the code to your website is just as straightforward as the previous steps. To begin, head over to your WordPress dashboard and open the post or page where you would like to add some schema markup.
First, you’ll have to activate the Custom Fields option. Activating the custom fields option allows you to add various types of data and metadata that apply only to a specific post or page. In this case, you can use it to add schema markup to your web pages.
Just creating a new custom field won’t be enough. You will also need to tell WordPress what to do with it by adding some code to some of your theme files. In some cases, you can use custom fields to simply provide more data to readers. In others, you can use them to add new behaviors to your post or page.
In this case, we just want to provide some information to search engines and browsers.
To get started:
Click on the three dots icon at the top right corner of your screen Navigate to Preferences and click on it Scroll down to Advanced Panels and check the Custom Fields option
Once you’ve activated the Custom Fields option, go back to your post or page and scroll down to the bottom where you’ll see Custom Fields Settings. Under Add New Custom Field, select Enter New to create a new custom field.
Next, you have to name your schema markup. In this example, we named ours “Article” because we wanted to add an article markup. This will let search engines and browsers know that the post or page contains an article. In general, however, you can name your custom field whatever you like.
In the resulting rich snippet, readers may then see extra information such as the name of the author. If you’re an expert in a particular field, this could be helpful, inspiring trust in people looking for information on that subject.
Once you’ve named your schema markup, you can paste your code snippet into the Value field. If you would like to then create more schema markup types for the same page or post, all you have to do is paste the second bit of code below the first. You can add as many you want.
When you’re done, click Add Custom Field, scroll to the top of the page and click Update to save your changes. At this point, you have successfully added a new custom field to your post or page, but you still need to tell WordPress what to do with it.
In this case, you need to add a piece of code to your header.php file that tells WordPress to ‘call’ your custom fields.
Before you proceed, be warned that any mistakes you make here could break your site, so make sure you backup your website first. Also, it is best to create a child theme so that you don’t lose these changes whenever you update your theme.
Here’s the code you need to add to your header.php file:
To find your header.php file, head over to Appearance > Theme Editor. On the right, you will see a series of files including your website’s header.php file.
Navigate to this file and click on it. This will launch a new window that allows you to edit it. Paste the code right before the closingtag.
Then, click on the Update File button and reload your site in a browser. That’s it! You have successfully added schema markup to your webpage.
To be sure that there are no errors, and that your markup is functioning properly, you should validate your page.
4. Use Google’s Structured Data Testing Tool to Validate
Google offers a Structured Data Testing Tool that you can use to test your website’s schema markup. All you have to do is open the tool and enter the URL of the page you want to test. The tool will scan the page and show all the structured data it finds. It will also tell you if there are any errors, which is useful if you wrote your structured data by hand.
You can also directly paste your markup into the tool to detect any errors before adding them to your website.
Get Ahead of the Competition With Schema Markup
Schema markup provides many benefits to any website, and it’s usually quite easy to add. You can add Schema markup to your website using a plugin, or do it the manual way as we’ve shown in this article. Schema markup is a great way of improving your site’s clickthrough rate. If you’re looking for even better SEO results, you should consider using a holistic SEO plugin.