search engine friendly faceted search in woocommerce

page duplication is a big problem for search engines. all well-optimized content is potentially diluted in regard to relevance because of slight variations that exist between other pages.

Burberry US & UK Sites

if a user can’t tell the difference between the us and uk burberry site, how can a search engine?

i think ecommerce shops have these types of issues the worst. the culprit is their faceted navigation. take the below scenario.

Buzzillions' Faceted Search

many combinations will be exact duplicates of others based purely on the order a filter is applied.

the image above shows how facets can easily narrow content through a combination of filters. with 3 facets and about 5 terms each, approximately 243 combinations are possible. another way to say it is that you have approximately 243 urls with potentially similar content!

with plenty of credit going to adam audette for the methodology, below is one way for webmasters to handle faceted search with a woocommerce site.

disclosure: the only woocommerce specific details in this exercise are the url parameters that identify product attributes.

noindex pages

do more searches exist for a clothing’s price or its size?

if you can answer “yes” to that question, then you may want to consider limiting what is indexed by search engines. doing so will help reduce the amount of pages a search engine can deliver that don’t necessarily serve our visitor’s best interests.

set canonicals

all duplicate pages that do occur because of faceted search should canonicalize to the preferred page. for example, pages /black/small/ and /small/black/ would contain identical information. since our cms is generating two urls for the same content, we need to tell search engines which one to index.

choose the one that matches how your visitor’s search. are user’s often searching for “black small shirts” or “small black shirts”? forcing the canonical to follow a certain convention eliminates duplicate content and increases relevance for high volume terms.

the code

place the below code into your functions.php and hook your function to the wp_head action.

/* faceted index rules */
function facetedrules(){
	$querystring = $_server['query_string'];
 
	$query = explode("&", $querystring);
 
	if (preg_match('/filter_rating|filter_price/', $querystring) || substr_count($querystring, "&") >=2) {
 
		echo '<meta name="robots" content="noindex" />';
 
	} else if (isset($_get['filter_color']) &amp;&amp; $query[0] === 'filter_color='.$_get['filter_color']) {
 
	    echo "			<link href="localhost:8888&quot;;
 
		echo $_server[" rel="canonical" />";
 
	} else if (isset($_get['filter_size']) &amp;&amp; isset($_get['filter_color']) &amp;&amp; $query[0] === 'filter_size='.$_get['filter_size']) {
 
		echo "			<link href="localhost:8888&quot;;
 
		echo $_server[" rel="canonical" />";
 
	} else if (isset($_get['filter_size']) &amp;&amp; $query[0] === 'filter_size='.$_get['filter_size']) {
 
		echo "			<link href="localhost:8888&quot;;
 
		echo $_server[" rel="canonical" />";
 
	} else if (empty($query[0])) {
 
		echo "			<link href="localhost:8888&quot;;
 
		echo $_server[" rel="canonical" />";
	}
 
}
 
add_action( 'wp_head', 'facetedrules' );

you will have to manually edit the function to look for the product attributes that match your set-up and also your own domain.

i know this isn’t the most sophisticated method to implement (as this can get out of hand depending on how many facets you have available) but i haven’t come across anything that resembles what is trying to be accomplished here.

that said, i’m focused on introducing a plugin that can handle the type of control webmasters want to see over their faceted search. be on the lookout for an update by me in the near future.

resources

2 thoughts on “search engine friendly faceted search in woocommerce”

  1. hello tom,

    i’ve just discovered your blog and going through some very interesting posts. thank you for the content!

    it seems there isn’t much information out there regarding woocommerce and seo. as this post is from 2012… do you know if the situation is any better? did you manage to introduce the plugin you mention?

    we are building a site with many variations so we wouldn’t like to be penalized by search engines.

    thank you very much!

Leave a Reply

Your email address will not be published. Required fields are marked *