Archived topic
Internal links nofollow
31 replies · Started by mad2toi on February 7, 2022
Hello, I have internal links in nofollow and I would like any dofollow. What is the add filter please action?
In comment
Hi mad2toi,
You can try adding a unique CSS class to the specific button, and use this class as a selector to perform JS to modify its rel attribute.
See this for reference: https://share.getcloudapp.com/wbuYBW0x
In my sample, I added website_url class to the button. I then created a Hook Element which I hooked to wp_footer. The code I added is this:
<script>
const website_url = document.querySelector('.website_url');
window.onload = function(){ website_url.setAttribute('rel', 'dofollow'); }
</script>
See this for reference: https://share.getcloudapp.com/2Nuv955X
Here it is working in my site: https://share.getcloudapp.com/KouYKBBd
Moreover, here is a reference to rel values you may use: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
Hope this helps! :)
Hello, thank you for answering me if you do not have a function.
Access
To have a better understanding of inquiry, may we know which specific links you’re referring too? Can you also kindly send a screenshot of these link?
Moreover, may we also know how you’re adding these “internal links”?
Hope to hear from you soon! :)
This warning triggers for any internal URL which was linked to internally using both follow and nofollow.
See this link for reference: https://sitebulb.com/hints/links/url-receives-both-follow-nofollow-internal-links/#:~:text=This%20Hint%20will%20trigger%20for%20any%20internal%20URL%20which%20was%20linked%20to%20internally%20using%20both%20follow%20and%20nofollow%20links.
To remove this warning, you would need to set either only follow or only nofollow for a URL.
For GenerateBlock blocks, to make a link nofollow or follow you can toggle the Add rel=“nofollow” option.
See this for reference: https://share.getcloudapp.com/YEuBYq2j
If you wish to remove all rel attribute for all links, you can try adding this JS through a Hook Element:
<script>
const elems = document.querySelectorAll('a[rel*="nofollow"]');
var index = 0;
var length = elems.length;
for ( ; index < length; index++) {
elems[index].removeAttribute("rel");
}
</script>
See: https://share.getcloudapp.com/NQuxmkbr
Also see: https://share.getcloudapp.com/KouY50y4
Hope this helps! :)
Hi, i have a bad result sorry
Hi there,
if those errors appeared after making the above changes then you should remove those changes.
But none of these are theme related.
Thank you but the problem is still not solved
I see, if that’s the case, since this isn’t theme related, it would be best to refer to the “How to fix” guidelines/instructions provided along with the warnings/errors in your screenshots.
See: https://share.getcloudapp.com/z8ukW9LQ
Feel free to reach out anytime if you’ll need help with anything else. :)
Hi
I need 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 ?
Here is a PHP code you can try: https://developer.wordpress.org/reference/hooks/comment_text/#:~:text=Remove%20rel%3D%E2%80%9Dnofollow%E2%80%9D%20from%20comment%20content%20text
Hope this helps! :)