Changing Product Tabs from JavaScript to CSS
Posted on 07. Jul, 2009 by coolbluelogo in Design, Magento
With themes based off the Modern Theme, product information tabs are buried under JavaScript. This is awful for SEO. Converting these to CSS allows the Search Engines to index more information on the product pages. This article will tell you how to do that and improve the Search Engine friendliness of your Magento site!
About the Author:
CoolBlueLogo is a Promotional Product Ecommerce site. Helping marketing professionals achieve success with their incentive and customer loyalty campaigns. CoolBlueLogo is Jonathan Martin, he can be reached at jonathan@coolbluelogo.com.
Search engines typically only read visible page content. This poses a problem with some Magento Themes product view page. With Magento themes (built around the Modern theme) the Product Description, We Also Recommend, Additional Information, and Product Tabs are embedded using JavaScript. While some feel this is a more visually appealing look, the search engines don’t.
Amazon.com is a great example of an ecommerce site that uses visible page promotional content to its marketing advantage. Product pages on Amazon are LONG and nothing is hidden behind tabs or embedded in JavaScript product tabs. This leaves more promotional content for the search engines to index. Having the product page content indexed is a must for any ecommerce site hoping to take advantage of organic search.
First, from the admin section go to system/configuration then drill down to the store level for the Configuration Scope and select the advanced/developer menu. Turn on Template path hints under the Debug tab.
Second, from the frontend choose a product page and verify that the tabs are in frontend/default/hellopress/template/catalog/product/view/tabs.phtml.
Then open the tabs.phtml file and around lines 33-46 you should see:
<ul class="tabs"> <?php foreach ($this->getTabs() as $_index => $_tab): ?> <?php if($this->getChildHtml($_tab['alias'])): ?> <li id="product_tabs_<?php echo $_tab['alias'] ?>" <?php echo !$_index ? 'class="active first"' : '' ?>><a href="#"><?php echo $_tab['title']?></a></li> <?php endif; ?> <?php endforeach; ?> </ul> <div class="padder"> <?php foreach ($this->getTabs() as $_index => $_tab): ?> <?php if($this->getChildHtml($_tab['alias'])): ?> <div id="product_tabs_<?php echo $_tab['alias'] ?>_contents"> <?php echo $this->getChildHtml($_tab['alias']) ?></div> <?php endif; ?> <?php endforeach; ?> </div>
Change it to:
<ul> <?php foreach ($this->getTabs() as $_index => $_tab): ?> <?php if($this->getChildHtml($_tab['alias'])): ?> <li style="margin-bottom:10px;width:100%;"><div class="tabs_new"><?php echo $_tab['title']?></div> <div><?php echo $this->getChildHtml($_tab['alias']) ?></div></li> <?php endif; ?> <?php endforeach; ?> </ul> <div class="padder"> <?php foreach ($this->getTabs() as $_index => $_tab): ?> <?php if($this->getChildHtml($_tab['alias'])): ?> <?php endif; ?> <?php endforeach; ?> </div>
This removes the JavaScript tabs and defines them with CSS class .tabs_new
In Boxes.css you can add .tabs_new anywhere but around line 153ish is the most relevant place.
.tabs_new {
margin-bottom:10px;
line-height:2em;
background:url(../images/tabs_bg.gif) repeat-x 0 100% #f2f2f2;
font-size:15pt;
font-weight:bold;
}
You can define the CSS product tabs anyway you see fit to match your current themes style. This will change tabs from something like this:

To something like this:

I hope you find the benefits to this as helpful as I have.
Good Luck and Happy Ecommerce!





14 Comments
Nightfly
20. Jul, 2009
Nice article, but as far as I can tell it does nothing for search engines, as they don’t care if you render something with JS or CSS as long as the content is in HTML. The “JS is bad for SEO” rule stems from a time when eg. JS menus had all their text (that means, keywords) in JS files instead of HTML elements, which is not the case with the tabs as they are simple lists.
dipta1988
28. Jul, 2009
I think Nightfly is right and as newer version came up that’s no longer problem but still nice article.
Name anton
04. Aug, 2009
thank you & the helpful tips.
pete
25. Feb, 2010
Yeah Nightfly is right its all about the markup with search engines, so long as the markup is html the js can do what it likes with it and search engines dont care.
Nice article though
Ecommerce Training
12. Mar, 2010
We talk about how to optimize Magento for SEO purposes and have lots more Magento video tutorials at our website, http://www.netsalestrainer.com.
It is completely free to join and everyone is welcome.
plumbum
18. Mar, 2010
Hi
sorry not working for Magento 1.4
Are you planning to update this article?
Woulde be great
zalak
05. Apr, 2010
yeah, really gr8 article.
Owen
06. Apr, 2010
thanks for this useful post! this is what i am looking for,i don’t really like using tabs,i like using one page to show verything of product info,include review,product questions..it looks pretty good now!
thanks again!
Robert
27. May, 2010
OK this is properly awesome – SEO is one of my biggest concerns on my magento sites – if this helps I’m definitely going to us it! Thankyou!
siyaram
30. Jun, 2010
nice posts,really Thanks
mark23
11. Aug, 2010
Nice post. Really good! Thanks for posting and sharing some ideas.
Magento Experts
06. Sep, 2010
Another great post. Very useful post for magento developers.
Thanks for sharing,
Magento Experts
Magento Kid
24. Oct, 2010
Hi,
Really like the blog some useful stuff there, if you fancy having a look at my own blog there’s a few things about Magento and all things webby. Check it out!
http://magentokid.blogspot.com/
Regards,
Magento Kid
Uk Office Chair Store
21. Nov, 2010
Thanks for that !
Leave a reply