Citations in schema

#496386
Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    Rank Math makes it possible for you to take a control of your SEO and you can easily extend the Rank Math JSON-LD output by making use of the following filter:

    /**
     * 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 [];
    }, 10, 2);

    The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    About the keywords, if you’re using the Article Schema, you can input them in this section:
    https://rankmath.com/kb/article-schema/#num-2-5-fill-the-details-in-the-schema-builder

    Hope that helps.

    Thank you.

    Does this require Pro version?

    Hello,

    The method mentioned by my colleague does not require the PRO version and can be used in Rank Math Free.

    Hope this helps to clear your doubts.

    Don’t hesitate to get in touch if you have any other questions.

    I’m sure I’m missing something.
    I added the filter via the Code Snippets plugin as you provided it.
    Now, how do I define the citation URLs to the post? I don’t see “citations” as an option when I click Article schema inside the post.

    Hello,

    Please note that the filter needs to be customized to add the citation to your site.

    Here’s a sample filter you can use and follow as a guide:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
       if ( isset( $data['publisher'] ) ) {
           $data['publisher']['citation'] = [
               'Your citation link',
               'Your citation link',
               'Your citation link',
               'Your citation link'
           ];
       }
       return $data;
    }, 99, 2 );;

    Hope that helps.

    Thank you.

    Reinelle!

    I thought you were providing me with the code I would copy & paste into my functions.php
    I do not know how to customize code. I am not a programmer.
    Would you PLEASE provide me with the EXACT code or instructions for using the code?
    This is the 4th back and forth. Can we PLEASE just complete this with one more communication? You know what I’m trying to accomplish, I’d appreciate if you’d provide me the COMPLETE information instead of all this back and forth.

    I want to defined several citation URLs to the schema of each post. Each post is using an Article type.

    Hello,

    Please note that the filter my colleague provided will be applied to all schema structures that contain the publisher property.

    So, if you are planning to add different citations for each post, you would need to create a condition for each post with their citations which is a tedious task, not to mention, you also need to edit the code again if you wish to add a new post with a new set of citations.

    With our PRO plugin, you would be able to easily apply these properties using our advanced schema builder without the help of a filter code: https://rankmath.com/kb/schema-generator/

    However, if you wish to continue using the filter code, kindly share 1 or 2 posts with their respective citations so we can create an example filter code that you can easily edit.

    Looking forward to helping you with this one.

    Are you saying with out the Pro plan I would need custom code for EACH blog post? With the pro plan I would add custom code filter once then be able to define the unique citations within each post?

    Hello,

    With the PRO plan, you won’t be needing the filter, instead, you can use the Advanced Schema builder that I mentioned in the previous reply to add the citations for your individual posts/pages.

    Hope that helps.

    OK I upgraded to PRO. I added citation URLs to Article and saved as a template. Does this mean anytime I make a change to a default setting it will not automatically apply to my posts & pages because they’re on a templated version? (e.g. type changed from BlogPosting to Article).

    Also, I don’t see how I can change the default Organization setting for “sameAs”. It’s a pretty standard setting these days to add the organization’s social media pages as sameAs.

    Hello,

    If you are using a template then the settings made for the default Schema in the Titles & Meta settings will not be applied to it. You will have to make the changes directly to the template.

    And please note that Google has changed a lot, and they get more intelligent every passing minute with AI and countless algorithms they have in place. They pick the Social profiles from across the web and they do not need you to have the “sameAs” tag to show the social profiles in your Knowledge Panel.

    However, you can add the sameAs property to the Schema by customizing this filter:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['publisher'] ) ) {
            $data['publisher']['sameAs'] = [
                'https://www.instagram.com/example',
                'https://www.facebook.com/example',
                'https://www.facebook.com/groups/example',
                'https://www.youtube.com/channel/example',
                'https://linkedin.com/example'
            ];
        }
        return $data;
    }, 99, 2 );;

    Hope that helps. Let us know if you need any other assistance.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Citations in schema’ is closed to new replies.