Site logo

[Resolved] rel=”me” for socialmedia links

Home Forums Support [Resolved] rel=”me” for socialmedia links

Home Forums Support rel=”me” for socialmedia links

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2523428
    Torsten

    Hello,

    I would like to have at the socialmedia links the rel=”me” attribute. Only this is not possible, not even via html.

    What is the reason for this? And how can this be done?

    Best regards

    Torsten

    #2523570
    Ying
    Staff
    Customer Support

    Hi there,

    How did you ad the social media links? Are you using the buttons block of Generateblocks?

    If so, we can make it work using a PHP snippet.

    Let me know!

    #2523618
    Torsten

    Hello Ying,

    thanks for the quick reply.

    I use the buttons block of Generateblocks.

    When I insert the rel=”me” attribute with html instead of visual an error is reported.

    Best regards

    Torsten

    #2523634
    Ying
    Staff
    Customer Support

    Yes, the blocks can not be edited as HTML simply.

    Try this:
    1. When you add the link, select nofollow.

    2. Add a CSS class to the button block, eg. social-link, so we can target the block in the PHP of step 3.
    https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

    3. Add this PHP snippet to replace the nofollow with me:

    add_filter( 'render_block', function( $block_content, $block ) {
    	
        if ( ! empty( $block['attrs']['className'] ) && strpos( $block['attrs']['className'], 'social-link' ) !== false  ) {		
    		
    		$block_content = str_replace('nofollow','me', $block_content );
    	}
       return $block_content  ;
    }, 10, 2 );
    #2523693
    Torsten

    Hello Ying,

    works perfectly 🙂

    Thank you for the extremely fast solution.

    Best regards

    Torsten

    #2523722
    Ying
    Staff
    Customer Support

    No Problem, glad to help 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.