How to add rel=”nofollow” to the top links in Magento

It is a good practice to add nofollow attribute to the links that are not important from SEO perspective, so link juice is not trickled down to these pages.

These links are on the top of the Magento pages:

My Account | My Wishlist | My Cart | Checkout | Log In

Here is what you have to do:

1. Open the following file:
app/design/frontend/default/[*yourTheme*]/template/page/template/links.phtml
– Replace [*yourTheme*] with whatever the name of your theme is. Replace it with ‘default’ if you are using the default theme.

2. Add rel=”nofollow” to the code on line 37

3. Test your pages


Didn't find what you were looking for? Try these links:
  • I was trying to modify the top.links.phtml file with no success until I found your article. Thanks a Bunch!

  • Youhou!! It works!
    Much eseayer than going in all the .xml file.

  • This is not good since you are also adding the nofollow to the bottom links (like sitemap).

    Do you know how to add the nofollow only to the toplinks?

    I can’t find a way to do it

  • I’m a moron. Can you tell me where in this line of code to add it?

    <li getIsFirst()): ?> class=”first”getIsLast()): ?> class=”last”getLiParams() ?>>getBeforeText() ?><a href="getUrl() ?>” title=”getTitle() ?>” getAParams() ?>>getLabel() ?>getAfterText() ?>

  • can you tell me more specific where i would add the no follow

  • app/design/frontend/default/[*yourTheme*]/template/page/template/links.phtml

    on line 37

  • It needs to go into the big ‘a’ chunk, anywhere in there just like class, title, etc are defined:

  • Thanks your post ! i got it too.

You can follow any responses to this entry through the RSS 2.0 feed.