serviceAreas in Schema ? ? ?

#93942
  • Resolved Mike Claggett
    Rank Math free

    Site URL below in Sensitive Data.

    I’ve added additional service areas to my schema built initially with the Schema Generation Tool in RankMath and my additions combined with the RankMath Schema passed Google’s Structured Data Testing Tool.

    Now I won’t that combined schema to at least be on my home page.

    Is there a way to do that through RankMath?

    … OR … will I have to disable RankMath’s Schema feature (Somehow) and just stick my All my new schema in my header.php file?

    Thanks for all you guys hard work.

    Please Advise on this isue as time allows,
    Mike Claggett
    M***@G*************

    • This topic was modified 3 years, 6 months ago by Mike Claggett.
Viewing 10 replies - 1 through 10 (of 10 total)
  • OOOPs – Forgot to leave you the site URL:
    https://aliciastaging.com/

    Hello,

    Thank you for getting in touch with us.

    Rank math adds schema to the pages via Json ld. You can use the following filter to extend Rank math the Json+ld data:

    
    /**
     * Collect data to output in JSON-LD.
     *
     * @param array  $unsigned An array of data to output in json-ld.
     * @param JsonLD $unsigned JsonLD instance.
     */
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	return [];
    }, 99, 2);
    

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Sorry – Doesn’t help if I don’t know where to put the “Collect data to output in JSON-LD” (Your code above).

    Do I edit the plugin to place that code and if at the top of which file?

    Where does that code go and where does my additional code go in relationship to your code.

    Again, Sorry you have a novice here.

    Mike

    Do I put the filter in function.php?

    If so, where or does it matter?

    And once deployed, how/where do I add my additional service area schema?

    Mike

    Please answer where to put the code question above please.

    Hello Mike,

    Sorry for the delayed follow up.

    The code is to be added to your functions.php.

    You can use tools such as this: https://technicalseo.com/tools/schema-markup-generator/ to generate your service schema if you haven’t had one already.

    
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['Organization'] ) ) {
            $data['Organization']['areaServed'] = [
               '@type' :'GeoShape'
        ];
        }
        return $data;
    }, 99, 2 );
    

    Looking forward to helping you. Thank you.

    ​​​​​​

    Ok Michael,
    I’ll give it a shot.
    But what is it supposed to do.
    Give me a place in the Schema Dashboard where I can enter the service area schema?
    Thanks,
    Mike

    Hello Mike,

    Thank you for the follow up.

    The filter adds the schema to your pages not schema fields. You can confirm this by checking your page source in rank math schema graph:
    img

    You can also your URLs with Google Rich results Test Tool: https://search.google.com/test/rich-results to confirm the markup is added.

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    Hi Michael,

    I got tired of trying to get it to work.

    So I disabled Schema in RankMath and put my own schema in the top of header.php.

    It is just a small local business site so it should be sufficient.

    I don’t think it will be needing special schema for every page.

    Thank for you help.

    Mike

    Hello,

    Sounds good.

    If you need help with anything else, please open a new support ticket here so we can help:

    https://support.rankmath.com

    We are always here for assistance.

Viewing 10 replies - 1 through 10 (of 10 total)

The ticket ‘serviceAreas in Schema ? ? ?’ is closed to new replies.