serviceAreas in Schema ? ? ?

  • 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
    Mike@GetFreedom.com

Viewing 7 replies - 1 through 7 (of 7 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

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

You must be logged in to reply to this ticket.