add "nofollow" to link to content aliased pages to avoid being penalized

General project discussion. NOT for help questions.
Post Reply
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

add "nofollow" to link to content aliased pages to avoid being penalized

Post by giggler »

Content Alias is great at keeping a site structure nice and clean without the need to jump around into different sections of the site. However, since it basically duplicates the content and add a different name to the url, this is seem as duplicated content for search engines.

Is there a way to add "nofollow" (either as default or as an option) to all links that goes to a content aliased page? This will avoid being penalized. The original content page will not have nofollow so the page will still be indexed...just not the content aliased pages.
Last edited by giggler on Mon Feb 11, 2008 9:21 am, edited 1 time in total.
nivekiam

Re: add "nofollow" to link to content aliased pages to avoid being penalized

Post by nivekiam »

Yes there is, you'll need to do this in your template, or at least part of it there.  After looking at the Content Alias module, I seriously doubt this is anything it can control.

For instance if these links are in a menu you can edit your menu template to look for the type.  Below is the default Simple Navigation menu.  If you look or search through there, you'll find   {$node->type}  The way I've added it to the menu should give you an example to get you started.  In the state below it will display the type of content the link is on the generated page, like contentalias.

If these are links you're adding to your pages another way, like cms_selflink, you'll need to use the more option of cms_selflink:
{cms_selflink page='37' text='development' more='rel="nofollow"'}

Code: Select all

{* CSS classes used in this template:
.activeparent - The top level parent when a child is the active/current page
li.active0n h3 - n is the depth/level of the node. To style the active page for each level separately. The active page is not clickable.
.clearfix - Used for the unclickable h3 to use the entire width of the li, just like the anchors. See the Tools stylesheet in the default CMSMS installation.
li.sectionheader h3 - To style section header
li.separator - To style the ruler for the separator *} 

{if $count > 0}
<ul>
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}

{if $node->current == true}
<li class="currentpage"><h3><dfn>Current page is {$node->hierarchy}: </dfn>{$node->menutext}  {$node->type}</h3>

{elseif $node->parent == true}
<li class="activeparent"><a class="activeparent" href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}  {$node->type}</a>

{elseif $node->type == 'sectionheader'}
<li class="sectionheader">{$node->menutext}  {$node->type}


{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />

{else}
<li><a href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}{if $node->target != ''} target="{$node->target}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}  {$node->type}</a>

{/if}

{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Re: add "nofollow" to link to content aliased pages to avoid being penalized

Post by giggler »

Thanks , I see the {$node->type} but I don't understand where you would put nofollow. I know where nofollow should go, but don't know how to tie the node type to nofollow...

Too bad there isn't a way to do this automatically with content alias because for clients, it would be so hard for them to know which ones are content alias when they select from the list of cms_selflink.
nivekiam

Re: add "nofollow" to link to content aliased pages to avoid being penalized

Post by nivekiam »

Something like:

{if $node->type == 'contentalias'}
  Then create a link that has rel="nofollow"
{/if}

It's going to take some heavy editing of the menu.  I got a pretty good feel for the css menu by tearing it apart line by line so you should be able to do the same.  That will make it automatic for the menu and end users wouldn't have to deal with anything.

For cms_selflink, you'll need to edit plugins/function.cms_selflink.php

I don't know exactly what you'd change, but that's where you'd make the change.  Of course that change won't be part of the base program so every upgrade you'll need to make the change again.
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Re: add "nofollow" to link to content aliased pages to avoid being penalized

Post by giggler »

thanks again!  I put this in as a feature request, so lets hope it will be in the default content alias in the future because I do think it's important...
Post Reply

Return to “General Discussion”