The Yireo ByAttribute module improves the SEO of a category-page when using the Layered Navigation options: It adds the chosen product-filter to both the title and the META-keywords of the page, but it also allows you to customize these settings.
Core fuctionality of ByAttribute
The core functionality of ByAttribute is that it adds a block with specific attribute-values somewhere on the page. By default, this is a list of manufacturers, but this can easily be any other attribute as well (color, size, tag).
Of course this gives a huge boost to your SEO, because ByAttribute automatically creates an unique collection of products for each attribute-value list.
But besides this core functionality, ByAttribte also allows you to improve page titles. This tutorial shows you how to fully customize the page title using XML-code.
Default Magento behaviour
By default, Magento uses the category-title as title-tag for a category-page (for example Computer). In most browsers, the title-tag is then displayed in the browser-bar or in the tabs. If the category has a parent-category, the title of the parent-category is also included on the page:
Computers - Electronics
Default Yireo ByAttribute behaviour
As soon as the Yireo ByAttribute module is enabled, it replaces the default title with the category-title plus the sitename:
Computers - MyShop
Now, if Layered Navigation is activated and you filter all products by manufacturer, the name of the current selected manufacturer is also added to the page-title:
Apple - Computers - MyShop
If you select after this the color Silver, this option is added again to the page-title:
Apple - Silver - Computers - MyShop
The order in which these options are added, is determined by the ordering of the product-attributes (managed through Catalog > Attributes in the Magento backend). The seperation-character ("-") can be modified through System > Configuration > Catalog > Search Engine Optimization.
Just like these filtered options are added to the page-title, they are also added to the META-keywords on that page.
Customizing the behaviour
The behaviour of these attributes being added to the page-title and keywords, can be modified through the layout-XML of Yireo ByAttribute module. The file app/design/frontend/default/default/layout/byattribute.xml can be copied to your custom template and modified there.
Please see the Using the Yireo ByAttribute module guide for more details.
Customizing the title-tag
The default behaviour described above involves the following XML-tag:
<action method="setTitle" />
Instead of using the default store-name, you can use your own custom title instead by adding a (first) argument to the XML-tag:
<action method="setTitle"/>
<default_title>My Custom Shop Title</default_title>
</action>
By default, any attribute used in the Layered Navigation is just added to the page-title. But this is sometimes not preferred: There could be a certain attribute (Price) that does not need to be included. The XML <action> allows you to skip such a tag by adding a second argument which involves a comma-separated list of attribute-names to skip.
<action method="setTitle"/>
<default_title>My Custom Shop Title</default_title>
<skip>price,resolution</skip>
</action>
In other cases, the value of the selected option is not really clear (Silver) so you might want to add the attribute-label as well (Color: Silver).
<action method="setTitle"/>
<default_title>My Custom Shop Title</default_title>
<skip>price,resolution</skip>
<addlabel>skip</addlabel>
</action>
More tutorials on ByAttribute
About the author
Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.