Archived topic
Adding Schema To My Website
11 replies · Started by Jodie on December 21, 2022
Hi,
What's the best way to add different kinds of schema (like Organization, Author, Article & Rating) to my website pages?
Thanks for your help!
Cheers Jodie
Hi Jodie,
You can try using a plugin for this.
Most of our users use either WP Schema Pro, RankMath, or Yoast. You can try each and see what works best for you.
Reminder: If you’re adding your own schema from any of these plugins, you may have to remove the basic schema GP adds. Here’s how to remove it – https://docs.generatepress.com/article/generate_schema_type/
Hi Fernando,
Is using a plugin the only way to do this? Can I do it via a php function?
Thanks for your help!
Cheers Jodie
Hi there,
there are sites that generate schema for you - like this one:
https://technicalseo.com/tools/schema-markup-generator/
Which can be added to a site using a Hook, set to the wp_head hook.
So for Organization schema where i assume the data would be static you could simply copy / paste.
For the Article schema where that data and possibly the JSON Structure will differ for each post there are 2 main options:
1. Manually generate schema for each post, store it in the posts meta using a custom field, and output that field using a hook.
2. Create PHP template parts that provide the necessary schema structure that is populated with dynamic data, some of which may require Custom Fields to be added to your post, hook the PHP template into the site.
Both of those methods require custom development, which is out of our scope. And to be honest I would not want the pain of maintaining either system when good plugins are available.
Hi David,
Great, thank you so much for your help! I'll keep investigating.
Cheers Jodie
You're welcome
Hi David,
The plugin I use (SEOPress) doesn't have an ability to put "author schema" on an author archive page.
Is there any way to do this with a PHP function?
Thanks for your help!
Cheers Jodie
What schema would you add there ? A Person JSON-LD maybe ?
And if so how many authors on the site ?
Greetings everyone!
I'm also working on implementing schema to my website https://makikulinarka.com/
It's a cooking/recipes website, so I want my articles to appear in the search; as you know, those blocks contain reviews and time and whatever. So I want to ask you about the manual implementation methodology. As much as I understand, I have to create my own schema. I already did create a JSON schema via using schema.com. So when it comes to implementing it directly to my post, can I copy that schema and paste it into the HTML block inside of my post? I believe that it won't appear on the front end, but it will appear on the back-end and view page source.
I would be grateful if you could confirm if I am right or wrong :)
Hi there,
yes you can copy and paste the schema script straight into a HTML Block. It won't show up on the front end but search engines will see it.
Hi David,
Yes, a "person" schema. And there's only one author on the site.
Cheers Jodie
Hi Jodie,
If that's the case, you can use https://technicalseo.com/tools/schema-markup-generator/ as mentioned by David.
Set the schema.org markup as Person.
Fill in the data, and copy the code generated to a Hook Element. Reference: https://docs.generatepress.com/article/hooks-element-overview/
Hook it to wp_head.
Set the display rule location to your preference.