Author Topic: Nofollow pages  (Read 9554 times)

inventric

  • Guest
Nofollow pages
« 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

fienieg

  • Guest
Nofollow pages
« Reply #1 on: April 29, 2005, 04:04:36 PM »
A no flow, should be included in a robots.txt file

Offline Ryan

  • Posts: 2048
  • Gender: Male
    • My Homepage
Nofollow pages
« Reply #2 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)
Website Baker Project Founder
https://WebsiteBaker.org

To contact me via email, visit:
www.ryandjurovich.c om

cmlawson

  • Guest
Re: Nofollow pages
« Reply #3 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?

Offline marathoner

  • Posts: 495
Re: Nofollow pages
« Reply #4 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";} ?>

cmlawson

  • Guest
Re: Nofollow pages
« Reply #5 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

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #6 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.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #7 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.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

aldus

  • Guest
Re: Nofollow pages
« Reply #8 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
« Last Edit: July 25, 2008, 04:45:59 PM by aldus »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #9 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:
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

aldus

  • Guest
Re: Nofollow pages
« Reply #10 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

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #11 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?
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

aldus

  • Guest
Re: Nofollow pages
« Reply #12 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

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #13 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">
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Nofollow pages
« Reply #14 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
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #15 on: July 25, 2008, 05:59:00 PM »
I agree, admin module or page settings option would be great!
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

aldus

  • Guest
Re: Nofollow pages
« Reply #16 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
« Last Edit: July 25, 2008, 07:32:20 PM by aldus »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #17 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
« Last Edit: July 25, 2008, 06:56:54 PM by Argos »
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

aldus

  • Guest
Re: Nofollow pages
« Reply #18 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
« Last Edit: July 25, 2008, 08:32:15 PM by aldus »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #19 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";
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

aldus

  • Guest
Re: Nofollow pages
« Reply #20 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

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Nofollow pages
« Reply #21 on: July 26, 2008, 12:05:53 PM »
Wonderful, Aldus!
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

storr

  • Guest
Re: Nofollow pages
« Reply #22 on: September 07, 2008, 05:24:39 PM »