In this article, we will consider such questions: “ How to prevent external links from indexing in WordPress? " and " How do I make links in the DoFollow blog comments?". The article is in the category of plugins, so we will do everything with their use.

But first you need to figure out why you need to open and close anything at all.

If the webmaster is not sure of the quality of the resource to which the link leads, then he closes it from indexing using the rel = "nofollow" attribute. The search engines Yandex and Google, seeing this value in the link, will not follow it, and also will not transfer weight.

And now a quite reasonable question: "Why then open links for indexing by search engines, make them Dofollow, if in this case weight will be transferred?"

Everything is quite simple here: those who are engaged in website promotion use Dofollow blog comments as an inexhaustible resource where you can get free external links. And links, as you know, have a certain impact on website promotion, albeit not as strong as before.

Webmasters use this for their own purposes, namely, the automatic filling of the site or blog with content (comments). And it also creates a kind of excitement on the blog, or rather its visibility, since messages are in fact left by spammers. But even so, visitors will have a certain amount of trust in the author after seeing the crazy number of comments on the blog. And it is possible that they will even add the page to bookmarks.

Plugin WP No External Links - close links from indexing

WP No External Links Plugin- an excellent WordPress plugin that allows you not only to automatically add an attribute that blocks links from indexing to all links, but also to make an internal link from an external link using a redirect. This is indicated in the plugin settings as - link "masking". By the way, the same "masking" method is used to hide referral links.

The plugin can be downloaded and installed from the WordPress admin area, or from here: http://wordpress.org/plugins/wp-noexternallinks/

Let's move on to the settings:

Add rel = nofollow- adding a nofollow value for the rel attribute.

Add target = ”_ blank”- highly useful option which adds target = ”_blank” to all xrefs. By enabling this option, all external links will open in a new window. This parameter is important for website optimization.

Add noindex tags- the expediency of using this parameter can be questioned, since rel = "nofollow" is quite enough to search engines Yandex and Google realized that there is no need to follow this link.

Do not mask links using redirects- my personal opinion, this function must be enabled. Search engines are constantly repeating: "The site should be natural!". What could be more natural than a simple external link?

And now the final touch: the plugin described above does not allow opening links in the author's name for indexing when submitting a comment.

This task will help to cope plugin - Do Follow... I will not write anything about its settings, for one simple reason - there are none. The plugin performs all its functions immediately after its activation. You can download everything from the same place - from the WP admin panel.

Greetings to all blog readers! Today I want to show you how to block links from indexing in blog comments. It is not difficult to do this even with minimal knowledge of php. If you have a lot of comments on your blog, then there is a great opportunity not to follow the links and miss a few open links, which is highly undesirable.

Of course, manually following the links in the comments is quite difficult, but installing an extra plugin because of this is also not an option. Therefore, I found, in my opinion, the most optimal solution, in which everything happens automatically, and you do not need to manually track open links.

What exactly is going on? Links are closed with tags and ... This is done by pasting the php code snippet into your WordPress blog files comment-template.php and functions.php. Everything is simple, fast, reliable, and there is no need to install an extra plugin that will create additional load and additional queries to the database.

Thus, you can safely not edit every comment by closing links manually or deleting them - all links are automatically closed from indexing by Yandex and Google. How to do it in practice?

First, let's tackle the functions.php file located in your WordPress template directory. You need to insert the following code into it:

Function wp_noindex ($ comment) (return str_replace (" ", "", $ comment);) add_filter (" comment_text "," wp_noindex "); add_filter (" comment_text "," wp_noindex2 ");

The code must be inserted before the closing tag?>. Many do not know this and insert code snippets in the first place in the file, and then wonder why the site stopped working. So, I repeat - just before the closing tag?> At the end of the functions.php file!

Now you need to make some changes to the comment-template.php file. You will not find this file in the theme template folder - it is located in the wp-includes folder. This folder is located in the site directory - where the .htaccess, robots .txt and sitemap .xml files are located. So, in the file comment-template.php you need to find a piece of code:

$ return = "$ author";

And replace this fragment with the next one, which contains the noindex tags that Yandex works with.

$ return = " $ author";

Now the work can be considered complete - your comments are protected from open links, and do not pose any threat to the blog. Links will be closed from indexing from the main search engines - Yandex and Google. See you in the following publications.

In one of my previous articles, I talked about blocking links from indexing using JavaScript. Today, I want to show you how to close a commentator's link from indexing in WordPress. In the article, I will give working examples of the code of a function that works on the scripts we discussed earlier to hide links from robots.

To begin with, you definitely need to read my article and insert the javascript you like into the "Footer" (footer.php). If you are already using one of the provided scripts, then just read the article further.

How to close comments in WordPress

I will not redescribe why you need to close comments and why you need to do it through JS. All this is well described in the previous article on this topic, as well as chewed and chewed in the comments to it. I'll just provide you with a working code of a function that will hide links that we don't like.

Example code for hiding a link to a commentator's site

As in the previous article, there will be several methods for closing a link. This is due to the fact that we can use 2 types of scripts from the last article, each of which is divided into two options - for HTML4 and HTML5, respectively. And so, let's get started.

We go to " Console»WordPress → Appearance -> Editor.

On the right in the templates we find and click on "Functions.php" In the opened editor, for convenience, we go down to the end of the code and insert the function code up to the line with the code?>, Having previously selected the desired option.

The first way to close the link of the author of the comment

Applies if the corresponding JavaScript from the previous article is used when the script opens the link itself (method 1)

For HTML4

"," href = "), // what we replace array (" "," rel = "), // array ("

For HTML5

/ * ================================================ =========================== * Function for closing the commentator's link via JS * Parameter $ link - html-code of the commentator's link * ====== ================================================== ================== * / function avd_comment_author_link ($ link) ($ link = str_replace (// call the replace function in the string array (" "," href = "), // what we replace // array (" "," rel = "), array (" "," data-url = "), // what do we replace $ link with // in the line with the html-code of the link); return $ link; // return a new link after replacement) // connect the filter add_filter (" get_comment_author_link ", "avd_comment_author_link"); / * ========================================= =============================== * /

The second way to close the link

It is used if a similar one is inserted. second JavaScript way, when JS replaces text with link code.

For HTML4

/ * ================================================ ========================== * Function for closing the commentator's link via JS * Parameter $ link - html-code of the commentator's link * ====== ================================================== ================== * / function avd_comment_author_link ($ link) ($ link = str_replace (// call the replacement function in the "href =" line, // what we replace "href = "#" class = "mylink" rel = ", // for html4 //" hfre = "#" class = "mylink" data-url = ", // what we replace $ link with // in the line with html- link code); return $ link; // return a new link after replacement) // add filter add_filter ("get_comment_author_link", "avd_comment_author_link"); / * =============================================== ========================== * /

For HTML5

/ * ================================================ ========================== * Function for closing the commentator's link via JS * Parameter $ link - html-code of the commentator's link * ====== ================================================== ================== * / function avd_comment_author_link ($ link) ($ link = str_replace (// call the replacement function in the "href =" line, // what we replace // "href =" # "class =" mylink "rel =", // for html4 "hfre =" # "class =" mylink "data-url =", // what we replace $ link with // in the line with html- link code); return $ link; // return a new link after replacement) // add filter add_filter ("get_comment_author_link", "avd_comment_author_link"); / * =============================================== ========================== * /

Attention!

  1. Before installing the function code, check for the link hiding script in footer.php. If you have not installed it yet, do it, guided by the corresponding article on my blog.
  2. Choose the function you want carefully. It must correspond to the used script, which closes links from indexing.

Video lesson of closing the author's link from indexing.

PS. If my article is useful to you, the best gratitude from you will be a subscription to our newsletter. If you have any problems or questions - feel free to write to us. We will always help you to cope with any difficulties.

On January 14, 2015 we released the Hide Links plugin, with which you can easily hide the link in the text of the article without manually adding codes and scripts. Also, this plugin automatically hides commentator links.

Hello friends, today I will tell you a simple way to get rid of the indexing of the links of the authors of comments, and at the same time leave the links outwardly in place. The solution was found by me on the Internet, it has been tested and works! =)

Once my blog was, this experiment was completed by me due to the huge number of open links in the comments, which negatively affected not only the high rate of "link spam" to my site, but also a decrease in trust from search engines. And now the nofollow tag doesn't help much. As far as I understand, the page weight smoothly flows to the pages of sites whose authors left comments in the article.

To date, I have solved this problem using the plugin WP No External Links, which simply replaced the link of the author of the comment with a link of the form "site / goto / link" as shown in the picture above.

After starting to use this plugin, the spamming of links really dropped significantly, which of course pleased me.

But at the same time, the number of comments dropped significantly. After all, many, one way or another, comment on sites because of links to them, and seeing in the comments the structure of the authors' links of the form "site / goto / link" did not dare to leave comments.

By the way, in the html-code of the page, this construction looks like this:

Olga Andreeva

In the end, I searched and found the following solution for this matter:

How to close commenter links from indexing without plugins?

The first thing I did was deactivate the plugin and return all commenter links to their normal state.

Olga Andreeva

After this step, I have to make changes to 2 files and the solution will be implemented!

1. I make changes to the file comment-template.php which is located in the folder wp-includes

I do not forget to make a copy of the file before editing, just in case, and look for the line in it:

"$ author";

And I change this line to this:

"$ author";

2. I make changes to the file footer.php your topic, literally before the closing tag I enter the following lines:

If you don't have jquery library enabled then in footer.php you need to insert one more line:

Now everything should work for sure! Checking that outwardly commenter links look like regular ones.


And the html-code of the page contains our little trick:

Olga Andreeva

As you have already noticed, there is no reference at all in the code like a href, instead we pasted into the file comment-template.php tag span, and the script added to the file footer.php, changed the pseudo-link to the current one. But, after going through this html-code, any search robot will not find any link, because there is simply no link there! =)

That's the whole solution. I hope it will be useful not only to me, but also to you, dear readers!

UPD dated March 27, 2016. Friends, I found a more practical solution! After all, with every update of the wordpress engine, it was necessary to change the file comment-template.php, and this is very troublesome and must always be remembered. I was looking for how to fix only theme files, which I do not update on my blogs, but usually I do it with my hands.

/ * =============================================== =========================== * Function for closing the link hidden-link * Parameter $ link - html-code of the commentator's link * ====== ================================================== ================== * / function avd_comment_author_link ($ link) ($ link = str_replace (// call the replacement function in the "href =" line, // what we replace // "href =" # "class =" hidden-link "rel =", // for html4 "hfre =" # "class =" hidden-link "data-url =", // what we replace $ link with // in the line with the html-code of the link); return $ link; // return a new link after replacement) // connect the filter add_filter ("get_comment_author_link", "avd_comment_author_link"); / * =============================================== ========================== * /

And in the code of the script itself, which I add to the footer.php file of my theme, literally before closing the tag I made some changes too:

You can also use the old script, it will also work when you add the above function, in the new script instead of the “text” parameter we use the “html” parameter, which allows you to make hidden links not only to text, but also to other objects, for example, pictures ...

This scheme of closing links on the site can also be used manually, i.e. you are writing an article and link to something useful, but you don’t want to openly refer to it, you just need to take such a link in the following code:

anchor links"

Attention!!! After testing this solution, I made sure that it does not work in all topics, it is likely that it needs to be finished for some specific topics.

Today, for me, this is the best solution to hide the links on the worpdress site in the comments and in the body of the articles themselves. If I can find a more effective solution to hide links, I will definitely supplement this article!

And we are still exploring our beloved island Bali, I will try to write here more often, a lot of materials have accumulated, we need to save them for ourselves, well, you see, it will be useful to read at your leisure! =)

Beauty from the monkey forest in Bali! =)

Good day everyone! Recently, I went to visit Alexander Karataev, on his blog I was interested in information about new methods of closing links from search engines and the plugin he developed. Today in the blogosphere this is one of the most discussed issues, after Yandex updated its algorithms. You can already see the ubiquitous picture of link indexing from comments. Many bloggers, fearing that links will end up in the index, simply delete the "Site" field in their comments, as a result, only information about the name of the reader and his email address remains, and many began to implement a special hook that hides the link from search engines and makes it non-clickable, i.e. to go to the reader's site, you must manually copy the link and paste it into the browser window. In my opinion, these two methods are not acceptable for a blogger, they create inconvenience in communication.

On the BCS forum this topic was also touched upon. It was there that I learned about a new way for search engines to bypass the indexing of links in a comment, in which the link itself remains clickable. And done
this with a plugin ARK HideCommentLinks... The plugin is free, freely available, download and install to your health! 😉 Many thanks again Alexander Karataev for the work done!

What the plugin does:

  1. Hides the link from search engines.
  2. Removes replytocom from comment replies link.

This plugin can be installed from the admin panel in the section PLUGINS, to do this, click the "add new plugin" button there and enter its name in the search bar ARK HideCommentLinks.

Note: this plugin works only with the standard comment form, closes links from indexing by search engines using a special script, leaving the link itself clickable.

After activating the plugin, four additional requests to the server appear. This is the loading of the styles and scripts of the plugin. The plugin itself is scanty, weighing 21 kb, the code is clean and without any problems, such as additional settings in the admin panel, etc. The scripts themselves are so small that they practically do not have any load on the server, I would in connection with this plugin drove the "ghost", as if it is and works, but really does not load anything)

During the work of the plugin, you can see that it changes the color of the links. It's all fixable, styles can be changed. To do this, go to Admin panel -> Plugins -> Editor, select the plugin from the list ark-hidecommentLinks further below we click on the file ark-hidecommentLinks.css, a window with styles will open in front of you.

Arklink (color: # 0944A2! Important; cursor: pointer! Important; / * link color, finger cursor * /) .arklink: hover (color: # f00! Important; / * link color * / text-decoration: none ! important; / * disable underline * /) .tooltip (border: 1px # 696969 solid! important; background: # FEFFE2! important; color: # 0944A2! important; border-radius: 5px! important; font: bold 14px Arial, Verdana; padding: 5px! Important; width: auto! Important; white-space: nowrap! Important;)

If you look at the structure of the plugin, then its developer made notes, thanks to which we can easily disassemble which parts of the code are responsible for what and make our own edits in it for the needs of our site.

This is the best solution at the moment! Unless of course you Devaka 😉

Related materials:

Classic WordPress widget

Hello everyone! As many have noticed, Wordpress has recently been updated to version 4.8. With the new update, as usual, new problems appear. And on ...

What is a CMS, as well as the rules for its selection

Now we will deal with the question: "What is a CMS?". In fact, everything is simple here, CMS stands for "Content Management Software" ("management software ...

How to place a flash banner on a website

It is quite easy to install a flash banner on your website - it is placed in the same way as a simple graphic banner. It is required to perform a couple of simple actions with which ...