[Support request] rel=”nofollow noopener” in links using Element>Block>page footer

Home Forums Support [Support request] rel=”nofollow noopener” in links using Element>Block>page footer

Home Forums Support rel=”nofollow noopener” in links using Element>Block>page footer

  • This topic has 1 reply, 2 voices, and was last updated 1 month ago by Fernando.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2276881
    Rostyslav

    Hello, there is no option to add no follow to the links in custom element footer.

    #2276931
    Fernando
    Customer Support

    Hi Rostyslav,

    You can add my-rel-link to the class list of the Headline Block as such: https://share.getcloudapp.com/jkuXWy6g

    Then add this PHP snippet:

    add_filter( 'render_block', function( $block_content, $block ) {
        if ( !is_admin() && 'generateblocks/headline' === $block['blockName'] && 'my-rel-link' === $block['attrs']['className'] ) {
            $block_content = str_replace( '<a ', '<a rel="nofollow noopener" ', $block_content );
        }
    
        return $block_content;
    }, 10, 2 );

    Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets

    Alternatively, you can open the code editor in the Block Editor and modify the HTML structure directly: https://share.getcloudapp.com/yAu1Q4Bo

    Hope this helps!

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