WebsiteBaker Community Forum

General Community => Global WebsiteBaker 2.8.x discussion => Topic started by: inventric on April 29, 2005, 03:28:15 AM

Title: Nofollow pages
Post by: inventric on April 29, 2005, 03:28:15 AM
Website baker is so great at search engine optimization, it would also be a great thing in its bag of tricks if it could create pages that won't be spidered.  

One way of doing this I was thinking is if there was yet another page type like "nofollow", and its a descendant in a way of public.  Meaning, like public the page shows up in the menu and anyone can get it (i.e. like a privacy policy, etc.) but the menu links is an anchor with a rel="nofollow" attribute (Google's way of knowing not to give value to this link).  

-Nate
Title: Nofollow pages
Post by: fienieg on April 29, 2005, 04:04:36 PM
A no flow, should be included in a robots.txt file
Title: Nofollow pages
Post by: Ryan on April 30, 2005, 02:08:10 AM
Yes, please use robots.txt - adding these kinds of features to WB will just make things confusing. 8)
Title: Re: Nofollow pages
Post by: cmlawson on May 02, 2007, 11:33:58 PM
It's too bad you feel this way because using the 'nofollow' tag on links actually helps you build your search rank, if done right. Maybe you could have a little checkbox attribute in the 'Change Settings' part of the page?
Title: Re: Nofollow pages
Post by: marathoner on May 24, 2007, 12:00:53 AM
I simply added a line of code to my template to do this. I didn't want robots following my photo gallery since that's a lot of bandwidth. My Photo Gallery page starts at page=14 so I added this to my template:
Code: [Select]
<?php if (is_parent($page_id) == 14) { echo "<meta name=\"robots\" content=\"nofollow\" />\n";} ?>
Title: Re: Nofollow pages
Post by: cmlawson on May 24, 2007, 11:36:42 PM
That's a great solution! Thanks for sharing.

I'd still like mod something so I can have the nofollow attribute on some of my links in the menu bar. I wonder if I could use what you have there to come up with something. If you have any ideas, please feel free to suggest. I'm coming from VB.NET and asp so I trip on PHP language stuff a lot. ;)

~cml
Title: Re: Nofollow pages
Post by: Argos on July 23, 2008, 03:54:17 PM
I simply added a line of code to my template to do this. I didn't want robots following my photo gallery since that's a lot of bandwidth. My Photo Gallery page starts at page=14 so I added this to my template:
Code: [Select]
<?php if (is_parent($page_id) == 14) { echo "<meta name=\"robots\" content=\"nofollow\" />\n";} ?>

Great, I was looking for this. Thanks! Would be nice to have this in the page settings admin though.
Title: Re: Nofollow pages
Post by: Argos on July 25, 2008, 04:30:55 PM
Well, I tried this, but the browser stops showing the page right before this piece of code. So the php must be wrong somehow.
Title: Re: Nofollow pages
Post by: aldus on July 25, 2008, 04:41:41 PM
Looks to me like the function "is_parent" isn't declared at all ...
What errors are shown if you set the errorlevel to E_ALL in the options?

Regards
Aldus
Title: Re: Nofollow pages
Post by: Argos on July 25, 2008, 04:49:13 PM
Could it be that the function "is_parent" not declared?
What errors are shown if you set the errorlevel to E_ALL in the options?
Fatal error: Call to undefined function: is_parent() in /home/httpd/vhosts/my_domainname_here/httpdocs/wb/templates/custom/index.php on line 41

What to do? I'm no coder, so I'm afraid I need copy&paste instructions  :roll:
Title: Re: Nofollow pages
Post by: aldus on July 25, 2008, 05:08:26 PM
Code: [Select]
<?php
/**
*  simple first hack
*/
 
if ( $page_id >= 14 ) echo "<meta name=\"robots\" content=\"nofollow\" />\n";

?>

Maybe you are in the need to change the 14 (page_number). As i don't know
how you will use it; as for one or more pages ...

Regards
Aldus
Title: Re: Nofollow pages
Post by: Argos on July 25, 2008, 05:18:34 PM
Of course I had replaced the ID with the one I want to use it for. So I have 34 instead of 14. But you asked if the "is_parent" was declared, and it seems it wasn't. So, how to do that?
Title: Re: Nofollow pages
Post by: aldus on July 25, 2008, 05:23:21 PM
As you can see in the code-snip you are not in the need of this function right here.

Copy n' paste - tell me what's happend.
Code: [Select]
<?php
/**
*  simple first hack
*/
 
if ( $page_id == 34 ) echo "<meta name=\"robots\" content=\"nofollow\" />\n";

?>


Regards
Aldus
Title: Re: Nofollow pages
Post by: Argos on July 25, 2008, 05:41:20 PM
Ah! I'm sorry, now I see... I didn't understand you gave me an alternative  :roll:

Yes, this works fine. Thank you!
Two follow-up questions:

1. How can I add more ID's?
2. And how can I combine these two lines?
<meta name="robots" content="nofollow,noindex">
<meta name="googlebot" content="nofollow,noindex,nocache,nosnippet">
Title: Re: Nofollow pages
Post by: Stefek on July 25, 2008, 05:55:15 PM
Hello.
This is a helpful snippet!

I think it's a missing feature in the WebsiteBaker CMS.
Isn't it possible to create a "Admin Module" for this (I'm no coder at all  :-D)

I have a idea of a list of all the pages created, where you could select either you want the robots to follow this page or not.

And it were a good thing for the next release of wb 2.7.x (where you could select the robots thing from inside the "Page-Settings")

Best Regards,
Stefek
Title: Re: Nofollow pages
Post by: Argos on July 25, 2008, 05:59:00 PM
I agree, admin module or page settings option would be great!
Title: Re: Nofollow pages
Post by: aldus on July 25, 2008, 06:08:11 PM
Edit: remove buggy code

Now you can add more ID's in the $ids - array and also add more metatags ..

Regards
Aldus
Title: Re: Nofollow pages
Post by: Argos on July 25, 2008, 06:54:28 PM
Not yet  :cry:

Parse error: parse error, unexpected '}', expecting ')' in /home/httpd/vhosts/my_domainname_here/httpdocs/wb/templates/custom/index.php on line 48
Title: Re: Nofollow pages
Post by: aldus on July 25, 2008, 07:26:41 PM
Code: [Select]
<?php

/**
*    @version    0.1.2
*    @build        4
*    @date        2008-07-25
*    @author        aldus *
*    @package    webside-baker
*    @state        @dev
*    @require    WB2.7
*
*/
 
$ids = Array (345566723);
 
$meta_tags = Array (
    
"<meta name=\"robots\" content=\"nofollow\" />\n",
    
"<meta name=\"googlebot\" content=\"nofollow,noindex,nocache,nosnippet\" />\n"
);

if ( 
true === in_array ($page_id $ids ) ) echo implode (""$meta_tags) ;
    
?>



Apologize for that - i know: first test - then post ...

Regards
Aldus
Title: Re: Nofollow pages
Post by: Argos on July 26, 2008, 12:47:42 AM
Nice, it's working like a charm now! I added one line just before the closing php-tag:

Code: [Select]
else echo "<meta name=\"robots\" content=\"index,follow\" />\n", "<meta name=\"googlebot\" content=\"index,follow\" />\n";
Title: Re: Nofollow pages
Post by: aldus on July 26, 2008, 09:08:43 AM
Code: [Select]
<?php

/**
*    @version    0.2.0
*    @build        5
*    @date        2008-07-26
*    @author        aldus *
*    @package    webside-baker
*    @state        @dev
*    @require    WB2.7
*
*/
 
$ids = Array (345566723);
 
$meta_tags = Array (
    
"<meta name=\"robots\" content=\"nofollow\" />\n",
    
"<meta name=\"googlebot\" content=\"nofollow,noindex,nocache,nosnippet\" />\n"
);

echo ( 
in_array ($page_id $ids ) ) ? 
    
implode (""$meta_tags) : 
    
"<meta name=\"robots\" content=\"index,follow\" />\n<meta name=\"googlebot\" content=\"index,follow\" />\n";

?>


To get rid of the "if-then-else" at this point and the unnecessary "," in the "else"-echo.

Regards
Aldus
Title: Re: Nofollow pages
Post by: Argos on July 26, 2008, 12:05:53 PM
Wonderful, Aldus!
Title: Re: Nofollow pages
Post by: storr on September 07, 2008, 05:24:39 PM
solved: https://forum.WebsiteBaker.org/index.php/topic,10965.0.html (https://forum.WebsiteBaker.org/index.php/topic,10965.0.html)