Archived topic
Internal links nofollow
31 replies · Started by mad2toi on February 7, 2022
Thank you for your feedback but it does not work with the theme. I need something custom
but it does not work with the theme. I need something custom
I can't see how this would be a theme-related question.
Did you find a solution that works in a Twenty series WP theme environment?
If so the exact same solution should work in GeneratePress.
If you haven't found a solution yet then I'd recommend checking with WP's support team on this.
Hi yes this code :
add_action( ‘wp_footer’, ‘twentytwentyone_add_ie_class’ );
function dofollow($url) {
$url = str_replace(‘ nofollow’, ”, $url);
return $url;
}
add_filter(‘get_comment_author_link’, ‘dofollow’);
But remplace twentytwentyone by ?
Can you solve it please ?
I don't think that line does anything.
Have you tried Fernando's solution here?
https://generatepress.com/forums/topic/internal-links-nofollow/#post-2120444
Hello, I have already tried but it does not work. Do you have a custom code please?
Hi there,
Can you share how you're running the code/s provided? It's possible the issue is w/ the codes not executing at all.
Let us know.
I've tested all the variations of the code provided and they all worked but to different degrees.
Can you specific which links do you want to specifically change the rel attribute to dofollow?
Is it only for the comment links? Or ALL the links on the site?
Let us know.
reminder: For PHP snippets, please a child theme's functions.php for a Code Snippets plugin for running PHP codes. Using the Parent theme's functions.php has a risk of your codes being wiped if you update the theme. Here's our recommended way of adding PHP - https://docs.generatepress.com/article/adding-php/
Thank you for your reply. I have internal nofollow link errors in my web pages.
To investigate further:
Can you link us to the specific page where this audit was done? I'll check the entire page if there are any other link with nofollow aside from the comments.
As for the comments:
Try this PHP snippet:
add_filter( 'get_comment_author_link', 'remove_nofollow_on_comment_links', 20, 3 );
function remove_nofollow_on_comment_links( $return, $author, $comment_ID ){
$comment = get_comment( $comment_ID );
$url = get_comment_author_url( $comment );
$return = '<a href="'.$url.'" rel="external ugc" class"url">'.$author.'</a>';
return $return;
}
The code worked perfect and thank you :) The audited site is madintouch.com
The code works but creates a conflict on my site. Do you know how to solve the problem?
The code itself literally just removes nofollow from the rel attribute.
These reports are completely unrelated to the code.
Reading some of the text on the image, the context is SEO related. (semantics)
Do you know how to solve the problem please ?
Do you know how to solve the problem please ?
You'll need an SEO plugin for this. :)
But as for the actual functionality of the specific SEO plugin you'll be using, we suggest talking to its support for best practices. :)