- 0.1 Quick Background
- 0.2 Where does Yoast SEO saves Title and Description
- 1 1- Use Generator to pull Title & Description from Yoast SEO
- 2 2- Use Filters to pull Title & Description from Yoast SEO (Preferred)
This tutorial will answer the question of how can you get the Schema Description and Title to pull in the Meta Description and Title from Yoast SEO plugin.
Schema plugin output the Title and Description from post title and trimmed portion of the content. So these aren’t a unique values. In many cases; it would make a lot of sense -recommended- to actually have a unique Title and Description for your content whenever is applicable.
Luckily, there are more than one available way to override the Schema output:
Here is an explanation on how to achieve that, but before we start we need to know where deso Yoast SEO saves the Title and description to be able to pull this data and introduce it to Schema plugin.
Where does Yoast SEO saves Title and Description
Yoast SEO mostly saves post related data in post meta. So, we need to know the unique post meta key where the Title and Description has been saved.
There is a couple of plugins that you can use to discover where data is saved in post meta without having to search your database, these plugin will simply show you a list of all post meta keys and values stored in a post in the post Editor page:
Yoast SEO post meta keys
Now, that we know where is the Title and Description values are saved, we can pull the values and use them in Schema output.
1- Use Generator to pull Title & Description from Yoast SEO
One very powerful feature of Schema is the built-in Post Meta Generator, which can be used to complete the missing properties of main entities, and also generates the post meta fields automatically for you.
So, let’s see how to pull Title and Description out of Yoast SEO and use them instead in the schema.org markup final output:
1- Select Post Type to configure
Go to Schema > Types > and choose the type you would like to configure.
2- Enable The Post Meta Generator
While you are on the Types editor page, you will see a checkbox to enable Post Meta Generator, checking that checkbox will show new settings, it’s where you can setup the Generator.
As you can see above, the Post Meta Generator is enabled, and new settings popped up, now you are ready to use post meta Keys from Yoast SEO to tell Schema that you want to use them in schema.org output.
3- Configure Post Meta from Yoast SEO
The Post Meta Generator has repeated fields functionality, this allow you to create unlimited post meta fields to pull any saved data to use in Schema.
Start with create two fields, one for the Title (Headline) field, and another for the Description field. Use post meta Keys we’ve discovered before like the following:
Save the type, and you are all set. Now, Schema will pull Title and Description from Yoast SEO.
2- Use Filters to pull Title & Description from Yoast SEO (Preferred)
This method require some code, you can use these filters to override the schema.org markup output:
This is the preferred method since it allow you to override the markup of the About and Contact pages as well as the main schema.org output for singular pages.
This code mostly goes in Theme’s functions.php file.