- This topic has 8 replies, 4 voices, and was last updated 3 months, 1 week ago by David.
June 13, 2020 at 10:14 am #1326612Jacob
Hi guys! You are always so helpful, have a bit of a technical question.
I’m having a bit of difficultly editing the sameAs schema. https://schema.org/sameAs – basically I can’t edit the schema markup at all.
I’m not clear if Yoast or if your theme already has some kind of schema implemented.
Do you have any suggestions on how I should edit it, code myself or a plugin?
Thanks!June 13, 2020 at 4:23 pm #1326831TomLead DeveloperLead Developer
GP adds very basic structured data to your HTML, which you can disable:
add_filter( 'generate_schema_type', '__return_false' );
As for JSON-LD, it looks like you’re using Yoast for that. I’m not sure if they allow for customization to the data, but I assume they do.
Perhaps this will help?: https://developer.yoast.com/features/schema/api/#social-profilesJune 14, 2020 at 3:20 am #1327146Jacob
Great thanks! I read more about it, it seems the most easy thing to do would be to just add the JSON-LD script to the <head> via one of your hook elements. I only wanna add it to the homepage. Correct me if I’m wrong, but that should simply things quite a bit.
1) If I leave your schema & Yoast on the site, will it create a conflict?
2) Where do I add the PHP function you suggested? PHP was never my thing lol.
Thanks again.June 14, 2020 at 8:45 am #1327548LeoStaffCustomer Support
1) Our recommendation is to disable GP’s schema if you are using Yoast so there isn’t any conflicts.
2) Adding PHP: https://docs.generatepress.com/article/adding-php/June 15, 2020 at 4:41 am #1328371Jacob
Thanks guys!June 15, 2020 at 6:05 am #1328456Jacob
Hey guys, Sorry I have one more question.
I gave up on plugins, I know JSON so i coded it myself. I created a generate press hook to insert my JSON into the <HEAD>.
However I now have:
<script type=”application/ld+json” class=”yoast-schema-graph”>
As you can see the Yoast script is set to a higher priority.
By any chance can you suggest a way to disable the Yoast script ONLY for the homepage?June 15, 2020 at 6:15 am #1328466DavidStaffCustomer Support
found this …. might be of use:June 15, 2020 at 6:25 am #1328481Jacob
great thanks! I found a different solution. The plugin you recommenced for php snippets allows you to select only the home page and I added this filter:
add_filter( ‘wpseo_json_ld_output’, ‘__return_false’ );
Sorry about that, I’m terrible with PHP.
Thanks again!June 15, 2020 at 6:30 am #1328495
- You must be logged in to reply to this topic.