The Schema types available with Rank Math are sufficient in most instances, but for some advanced users, that might not be the case. To make the process of adding custom Schema to the pages easier than ever, we created Custom Schema Generator in Rank Math PRO.
With the Custom Schema Builder that Rank Math offers, you can create a custom Schema, fill in the Schema, and add it to a page. Or, you could create a blank Schema structure and save it as a template, so that you can use it on multiple pages.
In this knowledgebase article, we will show you how you can take advantage of the Custom Schema Generator available with Rank Math.
Table of Contents
1 How to Add Custom Schema Using Rank Math’s Schema Generator PRO
Before we begin, you’ll need to ensure that Rank Math’s Schema module has been enabled on your website by navigating to Rank Math > Dashboard in your WordPress admin area.
Once you’ve enabled the Schema module, you can follow the steps discussed below to take full control of how you can add custom Schema to your posts & pages:
1.1 Edit Your Post or Page
To add a custom Schema, at first, head over to the edit screen for that post by clicking Edit as shown below:
1.2 Open Rank Math In the Gutenberg Sidebar
You can open Rank Math in the Gutenberg sidebar by clicking on the Rank Math SEO icon for the page.
Or click the three vertical dots in the top right-hand corner of the edit page and select Rank Math in the Plugins section as shown below:
1.3 Navigate to the Schema Settings for This Post/Page
Navigate to the Schema settings by clicking on the Schema tab and then click on Schema Generator.
1.4 Navigate to the Custom Schema
In the Schema Generator, click the Custom Schema tab as shown below.
Once you click on the tab, the Schema Builder will open up.
1.5 Add Property and Property Group
Custom Schema Builder allows you to add the properties and property groups by creating new fields. You can get started with a blank template like the one shown below, and then add your properties and property groups.
1.6 Saving Custom Schema
Once you’re done adding the properties, you can save the custom Schema. You could notice two options available here to save. Click on Save for this Post to save your Custom Schema only for this page.
If you wish to reuse this Schema on other posts, you can click the Save as Template button. The Schema will be saved as a template and can be accessed under Rank Math > Schema Templates.
Then, simply update the page as you normally would after making a change or click Publish button if this is a newly created page. You can then check your Schema with the help of Google’s Rich Results Testing Tool.
2 How to Add Custom Schema Using Schema Templates? PRO
As we mentioned in the previous step, Custom Schema can be saved as a template to reuse on other posts and pages of your website. You can follow the previous method to create a custom Schema to save a template or simply build one from scratch by following the steps discussed below.
2.1 Open Schema Templates
Head over to WordPress Dashboard > Rank Math > Schema Templates.
2.2 Add New Schema Template
The Schema Templates page will open up, and Rank Math will show all your Schema Templates here if you’ve already created any (including the ones saved from the post). To create a new Schema Template, click Add New button.
2.3 Choose Custom Schema
To create a custom Schema from scratch, click the Custom Schema tab.
2.4 Editing Custom Schema
The edit window over here will look like this, where you can add property and property groups. You could notice that Custom Schema Builder available under Schema Templates will include an additional tab named Display Conditions (we’ll look into this more in detail shortly).
2.5 Saving Schema Template
Once you’ve added the required properties and property groups, click the Save button.
3 Editing Options
Now that we have discussed how to create a custom Schema in brief, we will look into the editing options that Rank Math offers in detail.
3.1 Add Property
Each Schema type is associated with a set of properties. These properties are nothing but a structured way of adding information to a Schema Markup.
When you click the Add Property option, a new row will be added below the current one. Here you can enter the property’s name and its value. You can also refer to the detailed documentation from Schema.org for adding properties and to have an understanding of what data type(s) each property would accept.
3.2 Add Property Group
The difference between properties and property groups is quite simple. When properties can be organized in a logical way, it is better to put them in a group.
When you click Add Property Group option, you will get to define a new property group. You can now add any property as a child to this property group.
Hierarchies let us understand which property is associated with which property group. Since a Schema Markup can have more than one property group, nesting properties and property groups incorrectly can confuse and convey a meaning that isn’t intended.
For instance, AggregateRating is a Schema type that should be nested as a property group to the Product Schema (or other acceptable Schema types). But instead, if you are nesting it to the Review property group, although still inside the Product Schema, then it conveys a meaning that you’re rating a review (instead of rating the product). In fact, this will generate errors when tested with the Schema testing tool.
Rank Math’s Custom Schema Builder will help you avoid such troubles as properties and property groups are marked with clear lines, making it easy for you to visualize the hierarchy when building the Schema Markup.
3.4 Duplicate Property and Property Group
In some instances, you may come across the need to duplicate existing properties to add Schema properties quicker. The copy icon against each property lets you duplicate a property.
Similarly, you can also duplicate an entire property group by clicking the Duplicate Group option.
3.5 Deleting Property and Property Group
The Delete option will let you remove properties and property groups.
Caution: When you delete a property group, all the nested properties inside the property group will also be deleted.
The Custom Schema Builder support variables, hence, if the data (value) for the properties are already available on your existing post, then you don’t need to add them manually in Schema every time. You can easily reference it using variables, and if Rank Math finds any data assigned for these variables, it would automatically populate the value for these properties in the Schema Markup.
The following variables are available to use inside the Schema Builder. You can refer to this detailed resource on our variables to understand the data they refer to.
%sep% %search_query% %count(varname)% %filename% %sitetitle% %sitedesc% %currentdate% %currentday% %currentmonth% %currentyear% %currenttime% %currenttime(F jS, Y)% %org_name% %org_logo% %org_url% %title% %parent_title% %excerpt% %excerpt_only% %url% %post_thumbnail% %date% %date(F, jS, Y)% %modified% %modified(F, jS, Y)% %category% %categories% %categories(limit=3 & separator = | & exclude= 12, 23)% %tag% %tags% %tags(limit=3 & separator = | & exclude= 12, 23)% %term% %term_description% %customterm(taxonomy-name)% %customterm_desc(taxonomy-name)% %userid% %name% %id% %focuskw% %customfield(field-name)% %page% %pagenumber% %pagetotal% %pt_single% %pt_plural% %customterm(post_format)% %customterm_desc(post_format)% %randomword(word1| word2| word3)% %wc_price% %wc_sku% %wc_shortdesc% %wc_brand%
4 Validate Structured Data
The Custom Schema Builder includes a tab for Code Validation that would generate the JSON-LD code for the Schema Markup you’ve built. So you can easily validate the JSON-LD to identify errors in your structured data.
We recommend generating the JSON-LD code on a post or page, instead of Schema Templates. Since most properties in Schema Templates will be referenced using variables, testing the template’s code is defeating the purpose of the Code Validation.
To validate your structured data, you can follow the exact steps discussed below.
4.1 Open Code Validation Tab
In the Custom Schema Builder of a post/page, click the Code Validation tab, as shown below.
4.2 Copy the JSON-LD code
Under the Code Validation tab, you will see the actual JSON-LD code for the custom Schema you’ve created. Make sure that your post is saved as a draft at least; otherwise, you won’t see the complete code.
On the top-right corner, you will see 2 buttons — Copy and Test with Google.
The Copy button will let you copy the code to your clipboard to validate using any Schema Testing tool. Or alternatively, you can click the Test with Google button, so that the Google Rich Results Testing Tool will open in a new tab with Schema data already pasted in the tool.
4.3 Validate on Google Rich Results Testing tool
To test the code, all you have to do is click the Test Code button, and Google will test the code and tell you if it is valid.
Here is how the results should look like.
Using the Code Validation feature, you can quickly identify if the Schema you’re adding to your website or page is valid or not, which will save you a bunch of time and headaches in the future.
5 Display Conditions
As we mentioned earlier, the Custom Schema Builder under the Schema Templates includes an additional tab — Display Conditions.
The custom Schema created under the Schema Templates can be practically applied to any post/page on your website just by setting by rules. So in short, the Display Conditions option makes the Schema Automation at scale, possible.
To create a Display Condition for adding the Schema Markup, click the Display Conditions tab in your Custom Schema Builder.
Now, let us discuss the different options available in detail.
5.1 Inclusion and Exclusion
Display conditions can be of 2 types. Inclusive or exclusive.
Inclusive – when you choose Include, all the pages that fulfill the conditions will get the Schema.
Exclusive – when you choose to Exclude, all the pages that fulfill the conditions will not get the Schema.
This way, you will have complete control over the pages where the Schema is added. You can choose the type of rule by clicking the drop-down menu and selecting the rule type of your choice.
5.2 Entire Site, Archives and Singular
The following options will help you target pages for adding/excluding Schema.
Entire Site – this option lets you target all the pages on your website, but not limited to the homepage, posts, pages, and archives.
Archives – targets specifically to author pages, search pages, categories, tags, and archives pages of other custom taxonomies available on your website.
Singular – to target single pages of post types, but not limited to posts, pages, or any custom post types you’ve created on your website.
Depending on the option you’ve chosen to target, you will see additional options come up on the screen. However, when you choose the Entire site, no further targeting options will appear, as it is obvious to target the entire website.
Here is what you will see if you choose Archives. From the new drop-down menu, you will be able to choose which archive pages the Schema should be added to.
If you choose Singular, you’ll be able to choose posts, pages, or custom posts types (if you’ve created them on your website) from the new drop-down menu.
The filtering option is where you finally decide the pages or posts the Schema gets added to. For example, if you choose Archives > Category for targeting, then the filtering will help you choose which category the Schema will actually be added to.
All you have to do is start typing the name of the category, post, page, or whatever targeting you’ve chosen, and Rank Math will search for them and let you select them. Here is a demo.
The same process will be used regardless of what targeting you’ve chosen; it works for authors, categories, tags, pages, and posts. If you want to add more than one category to the display condition, you will need to add another rule.
5.5 Adding and Deleting Rules
To make the targeting precise, you can only choose specific display conditions. But, there will be many cases where you’ll need to add the same Schema to multiple categories. That is where stacking comes into play.
In simple words, you can create multiple rules that stack on top of each other to create complex targeting options with ease. Here are a few examples of complex targeting options that can be created with Rank Math’s targeting options easily.
- Posts that appear in category 1 and category 2, except for posts that are also in category 3
- All singulars in a particular category except pages that have a certain tag
- All pages on your website except a few pages that you handpick
- All posts are written by a specific author
And many more.
When you click the Add New Condition option, a new row will appear below to add another condition. In this way, you can combine your conditions with Include/Exclude setting to add the custom Schema you’ve built, more accurately only to the pages you want to add them.
You can also delete a specific condition by clicking the Remove option next to the condition.
Since there is no limit to the number of rules you can add, you’ll have complete granular control over which pages get the Schema.
5.6 Rule Priority
Since there are many rule types, it is important to know which rules take precedence over others. Without going into too much detail, you should know the following:
- Exclude takes priority over Include
- Singular & Archive takes priority over the Entire site option.
Hopefully, this will help you create better rules for your website.
6 Use Cases with Custom Schema Generator
Here are some popular use cases of Custom Schema Generator for building advanced Schema types.
6.1 Employer Aggregate Rating
This Schema lets you evaluate an organization on the basis of an employer and then add a rating to help job seekers. The Schema for Employer Aggregate Rating can be easily built with Custom Schema Builder as shown below.
In the example above, we’ve used some variables that would refer to data. Some of these variables are pointing to custom fields that you may need to modify according to your website if you’re planning to implement the Schema.
%title%– the variable refers to the title of the post (preferably the name of the organization you’re evaluating).
%customfield(employer-url)%– points out to the custom field named
employer-url, which is holding the URL of the organization/employer being evaluated.
%customfield(rating-value)%– points out to the custom field with name
rating-value, that holds the aggregate rating value for the employer.
%customfield(rating-count)%– points out to the custom field name
rating-count, that holds the total number of ratings or votes for the employer.
6.2 Subscription and Paywalled Content
This is another popular use case of Custom Schema Builder when you want search engines to index your paywalled or locked content. The structured data clearly communicates the sections inside your pages that are locked and helps Google distinguish the page from the ones involving in cloaking.
The following properties are used in marking the sections that are locked from users’ accessing.
- isAccessibleForFree – takes a boolean value (true or false) that lets you set if the page has content that is not accessible for free.
- cssSelector – includes the CSS selector that holds the content that is not available for free (Google search guidelines recommend using class selectors).
While the above example shows how to mark a single paywalled section inside a post, the guidelines provided by Google include instructions for marking multiple sections behind the paywall.
These are only a few use cases of Custom Schema Generator, but, in reality, you can use the Schema Builder, to practically build any type of Schema described in Schema.org documentation.
And, that’s it! If you still have absolutely any questions on using Schema with Rank Math, please feel free to reach our support directly from here, and we’re always here to help.
Was this article helpful?
Still need help?
Submit Your Question
Please give us the details, our support team will get back to you.