[Resolved] sameAs Schema

Home Forums Support sameAs Schema

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1326612
    Jacob

    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.

    Long story short, I want to edit the JSON array to include this type of markup, but I’m not too clear how to edit it. I’m pretty ok with Javascript if you can point me with the right direction, I just get confused with PHP.

    Do you have any suggestions on how I should edit it, code myself or a plugin?

    Thanks!

    #1326831
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    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-profiles

    #1327146
    Jacob

    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.

    #1327548
    Leo
    Staff
    Customer 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/

    #1328371
    Jacob

    Thanks guys!

    #1328456
    Jacob

    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”>
    <script type=”application/ld+json”>

    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?

    #1328466
    David
    Staff
    Customer Support
    #1328481
    Jacob

    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!

    #1328495
    David
    Staff
    Customer Support
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.