Nofollow pages


Argos

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

aldus


<?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

Argos

Nice, it's working like a charm now! I added one line just before the closing php-tag:

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

#19

<?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

Argos

#18
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
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

aldus

#17
Edit: remove buggy code

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

Regards
Aldus

Argos

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!

Stefek

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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Argos

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!

aldus

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.

<?php
/**
*  simple first hack
*/
 
if ( $page_id == 34 ) echo "<meta name=\"robots\" content=\"nofollow\" />\n";

?>



Regards
Aldus

Argos

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


<?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

Argos

Quote from: aldus on July 25, 2008, 04:41:41 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

#9
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

Argos

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!

Argos

Quote from: 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:
<?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!

cmlawson

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

marathoner

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:
<?php if (is_parent($page_id) == 14) { echo "<meta name=\"robots\" content=\"nofollow\" />\n";} ?>

cmlawson

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?

Ryan

Yes, please use robots.txt - adding these kinds of features to WB will just make things confusing. 8)
Website Baker Project Founder
[url="https://websitebaker.org"]https://websitebaker.org[/url]

To contact me via email, visit:
www.ryandjurovich.com

fienieg

A no flow, should be included in a robots.txt file

inventric

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