Adding twitter cards and social media to structured data

#68251
  • Resolved Duncan
    Rank Math free

    Hiya, can anybody advise me on how to:

    1. add my social media accounts to structured data

    2. Adding a twitter card to my site. I understand this needs to be added to my header – is this a header from Rank Math. I currently have google analytics in my theme header

    Any help would be great please

    Thanks in advance Duncan

Viewing 15 replies - 1 through 15 (of 19 total)
  • Duncan
    Rank Math free

    I wondered if anyone would be able to advise on both of these please?

    Hi

    Thank you for getting in touch.

    You can add you Twitter and Facebook accounts, the only social meta considered by Google and Bing knowledge graph, in Rank math > Titles & Meta > Social meta. The data added here is automatically added to your site meta data.

    For social sharing, open graph tags are the meta used. To globally set your opengraph image and twitter cards, head to Rank math > Titles & Meta > Global Meta and set the image plus the twitter card type. This can be modified on page/post basis, by using Rank math metabox under the social tab.

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

    Thank you.

    Duncan
    Rank Math free

    just to add the global meta does not allow me to add linkedin or instagram or anywhere? I have also added Facebook to my social meta but still doesnt appear?

    Alberto
    Rank Math business

    Hello,

    Could you try by adding the following code at the end of your functions.php file and after saving it, clear the cache (if any)?

    /**
    * 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 ) {
    	$currentSameAs = $data['Organization']['sameAs'];
            $currentSameAs[] = "https://www.facebook.com/influenceassociation";
            $currentSameAs[] = "https://www.instagram.com/duncanstevensofficial/";
            $currentSameAs[] = "https://www.linkedin.com/in/duncanstevensevents/";
            // And so on...
    
            $data['Organization']['sameAs'] = $currentSameAs;
    	return $data;
    }, 10, 2);

    Looking forward to help you.

    Duncan
    Rank Math free

    Hi Alberto, Thanks for your message. I have added this and re-run the test and it is still saying they are not part of structured data – my website is https://duncanstevens.com Thanks again

    Alberto
    Rank Math business

    Hello,

    I think we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Duncan
    Rank Math free

    Hiya Alberto, Thanks for your kind offer – I have recently had a few issues with hacking etc so am hesitant to do so. I am happy to do a share screen call with you if you have a convenient time available please? Alternatively if you let me know what to look for I can find it that way. Thanks again and hope you understand πŸ™‚

    Alberto
    Rank Math business

    Hello,

    It is fine. At least, could you share (in the Sensitive Data section) the website URL so we can check the Schema by ourselves and try to determine the issue?

    Looking forward to help you.

    Duncan
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Alberto
    Rank Math business

    Hello,

    Could you paste here (or in the Sensitive Data section) the code you added in the functions.php to modify your “sameAs”? So we can check if there is an issue.

    Looking forward to help you.

    Duncan
    Rank Math free

    Will you be available for a skype call / screen share option please?

    Alberto
    Rank Math business

    Hello,

    I am sorry but we can’t offer than kind of support but I have checked the code and it seems like it is not properly formatted. Make sure you paste it exactly as this one:

    /**
    * 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 ) {
    $currentSameAs = $data['Organization']['sameAs'];
    $currentSameAs[] = "https://www.facebook.com/influenceassociation";
    $currentSameAs[] = "https://www.instagram.com/duncanstevensofficial/";
    $currentSameAs[] = "https://www.linkedin.com/in/duncanstevensevents/";
    // And so on…
    
    $data['Organization']['sameAs'] = $currentSameAs;
    return $data;
    }, 10, 2);

    If it still doesn’t work, let us know.

    Looking forward to help you.

    Duncan
    Rank Math free

    Hiya, Thanks for your message my developer has copied and pasted it like that. What is the formatting issue please?

    Hello,

    Could you please try the follwoing

    
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['Organization'] ) ) {
            $data['Organization']['sameAs'] = ['https://twitter.com/RankMath', 'https://facebook.com/Rankmath'];
        }
        return $data;
    }, 99, 2 );
    

    Change the URLs to your social URLs

    Looking forward to helping you. Thank you.

    ​​​​​​

    Duncan
    Rank Math free

    Is anybody able to help with this further please? Alberto – can you assist please?

    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 15 replies - 1 through 15 (of 19 total)

The ticket ‘Adding twitter cards and social media to structured data’ is closed to new replies.