vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Apply "rel=nofollow" attribute to all parsed URLs (https://vborg.vbsupport.ru/showthread.php?t=93780)

kall 08-06-2005 10:00 PM

Apply "rel=nofollow" attribute to all parsed URLs
 
In the first cooperative move for nearly ten years, the major search engines have unveiled a new indexing command for web authors that they all recognize, one that they hope will help reduce the link and comment spam that plagues many web sites....due to removing the point of doing it in the first place.

The new "nofollow" attribute that can be associated with links was originated as an idea by Google in late 2004 and MSN and Yahoo, as well as major blogging vendors have jumped onboard.

The Nofollow Attribute

The new attribute is called "nofollow" with rel="nofollow" being the format inserted within an anchor tag.
When added to any link, it will effectively serve as a flag to tell the search engines that the link has not been explictly approved by the site owner, and therefore "not follow" it, or not use the referring page's (on your site) Page Rank in any way.

For example, this is how the HTML markup for an ordinary link might look:

Quote:

<a href="http://www.somedomain.com/page.html">My forums are the best lol lol lol click here!!</a>
This is how the link would look after the nofollow attribute has been added, with the attribute portion shown in bold

Quote:

<a href="http://www.somedomain.com/page.html" rel="nofollow">My forums are the best lol lol lol click here!!</a>
Once added, the search engines supporting the attribute will understand that the link has not been approved by the site owner.

Think of it as a way to flag to them, "I didn't post this link -- someone else did, don't associate me with it."

Quote:

Originally Posted by Alkatraz
If Google sees nofollow as part of a link, it will:

1. NOT follow through to that page.
2. NOT count the link in calculating PageRank link popularity scores.
3. NOT count the anchor text in determining what terms the page being linked to is relevant for.

The site that is being linked to will gain nothing from the link, so the whole point of doing it in the first place is removed.

This will affect URLs in posts, as well as signatures...anything that goes through the bbcodeparse function as far as I can tell/guess, and will work recursively, or whatever the word is that means 'it will affect all existing posts and signatures'...or it did for me anyway.

To change the conditional number of posts, alter
PHP Code:

OR $post['posts'] > 50

to whatever you like.

I can't see how this could be done as a plugin, but if anyone wants to point out how, that would be nicer....YAY Kirby!

Now all you need to do is unzip the attached file, upload the plugin using your Admin CP - Plugin System - Plugin Manager!

Relax, safe in the knowledge that spammers linking from your site are doing so for no reason whatsoever. :)

To remove the old version:

File to modify: 1

1/ Open your includes/class_bbcode.php file

Find:
PHP Code:

        // standard URL hyperlink
        //return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";

        
global $post;

if (
is_member_of($post6//Admins are exempt
OR is_member_of($post5//Mods are exempt
OR is_member_of($post7//SuperMods are exempt
OR $post['posts'] > 50// People with over 50 posts are exempt
    
{
    
// standard URL hyperlink
    
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
    }
    else
    {
     return 
"<a href=\"$rightlink\" rel=\"nofollow\" target=\"_blank\">$text</a>";
    }
    } 


Replace with:
PHP Code:

// standard URL hyperlink
        
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
    } 

2/ Save and Upload.

mcncyo 08-07-2005 11:06 AM

I will install this on monday.

bigcurt 08-07-2005 12:48 PM

Good job kall, will work great

~Curt

FleaBag 08-07-2005 11:05 PM

I'm not going to install this as my forum doesn't need it, microscopic in size compared to the majority - but just thought I would post my support for an excellent effort!

Andreas 08-08-2005 03:33 PM

Hook bbcode_create
PHP Code:

$this->tag_list['no_option']['url']['callback'] = 'handle_external';
$this->tag_list['no_option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
$this->tag_list['option']['url']['callback'] = 'handle_external';
$this->tag_list['option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';

if (!
function_exists('handle_bbcode_url_relnofollow'))
{
    function 
handle_bbcode_url_relnofollow(&$parser$text$link)
    {
        global 
$post;
        
// Excempt Mods+ and Users with mor then 50 Posts
        
$parsedurl $parser->handle_bbcode_url($text$link);
        if (
is_member_of($post567) OR $post['posts'] > 50)
        {
            return 
$parsedurl;
        }
        else
        {
            return 
str_replace('href="''rel="nofollow" href="'$parsedurl); 
        }
    }


Or (simpler, but might affect mor then just [url])
Hook: bbcode_parse_complete
PHP Code:

global $post;
if (!
is_member_of($post567) AND !($post['posts'] > 50))
{
    
$text str_replace('href="''rel="nofollow" href="'$text);



ricker 08-09-2005 03:12 AM

This seems to have conflicts with the "PM group leader on join request" plugin. At least it did with mine. :(

mcncyo 08-10-2005 12:57 AM

would the work with grapping of the newsgroup and from mailinglist? Would the plugin work with the nntp newsgroup pulling.

kall 08-11-2005 09:42 PM

Quote:

Originally Posted by ricker
This seems to have conflicts with the "PM group leader on join request" plugin. At least it did with mine. :(

I can't see how .. all this does is add an attribute to the href of a link.. can you please explain?

welo 08-30-2005 05:46 AM

Quote:

Originally Posted by KirbyDE
Hook bbcode_create
PHP Code:

$this->tag_list['no_option']['url']['callback'] = 'handle_external';
$this->tag_list['no_option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
$this->tag_list['option']['url']['callback'] = 'handle_external';
$this->tag_list['option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';

if (!
function_exists('handle_bbcode_url_relnofollow'))
{
    function 
handle_bbcode_url_relnofollow(&$parser$text$link)
    {
        global 
$post;
        
// Excempt Mods+ and Users with mor then 50 Posts
        
$parsedurl $parser->handle_bbcode_url($text$link);
        if (
is_member_of($post567) OR $post['posts'] > 50)
        {
            return 
$parsedurl;
        }
        else
        {
            return 
str_replace('href="''rel="nofollow" href="'$parsedurl); 
        }
    }



For some reason I have no idea whatsoever how to apply this code. Is this basically a replacement in class_bbcode.php for what Kall originally posted?

kall 08-30-2005 11:19 AM

Quote:

Originally Posted by welo
For some reason I have no idea whatsoever how to apply this code. Is this basically a replacement in class_bbcode.php for what Kall originally posted?

You can just upload the attached .xml now, thanks to Kirby. :)

(Could a Mod move this to the Plugins Forum? Ta.)


All times are GMT. The time now is 11:37 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01280 seconds
  • Memory Usage 1,781KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete