xpathbuilder.com: An awesome SEO research tool

I have a wide range of development experience with WordPress and Magento.  But I also love to sink my teeth into custom projects.  So when my colleague Ryan Boots approached me about a unique site concept, I had to pursue it.

As an SEO professional, Ryan was looking for an easy way to study search engine results, preferably within a spreadsheet.  After some research, he discovered Google Doc spreadsheets supported an importXML function which, combined with XPath code, can instantly import Google search results.  The problem was that putting the code together for different queries ate up a lot of time.  In addition, he wanted to scrape results from Bing and Yahoo, which require completely different XPath code.

So he approached me about putting together a site that would generate importXML strings quickly for multiple queries and search engines.  The result: xpathbuilder.com.

A few notes:

  • The tool was 100% custom development from the ground up.  The string fields are built with jQuery.
  • We started with a handful of search engines – Google, Yahoo, Bing and Ask.  We also tossed in Google Suggest – the autocomplete feature you see when entering a search term in Google.   But we built the tool with expansion in mind, so we’ll probably add more search engines down the road, pending user feedback.
  • We put quite a bit of thought into the usability of this tool.  We’re hoping that a reasonably intelligent site visitor will find it fairly straightforward to use.

We’re hoping this will become a useful tool in the SEO community.  It’s already getting some positive attention on Twitter, and Distilled had some nice things to say about it, which is gratifying.

Do me a favor?  Go check it out and let me and Ryan know what you think.  If you see a way it could be improved, we especially want to hear from you.

Magento: Sort Product Options by Value

Today I was presented with a Magento configurable product that has options that were not appearing in order when you clicked the drop down. A quick look with Firebug showed me that the drop down option values would be in proper alpha numeric order if I simply sorted the values of the options. First thing I thought to do is fix it with jQuery. So I created and uploaded a JavaScript file with a jQuery function I found online for sorting the options by value. Here’s the contents of that file:


      jQuery.fn.sortOptionsByValue = function()
      {
      var byValueSortCallback = function(x, y)
      {
      var xVal = jQuery(x).val();
      var yVal = jQuery(y).val();
      return (xVal < yVal) ? -1 : (xVal > yVal) ? 1 : 0;
      };
      return this.sortOptions(byValueSortCallback);
      };




Next thing I did was open up my Magento layout/catalog.xml file and locate the XML block that begins with catalog_product_view. Below that you will find a reference name=”head”. In there I inserted the following action which includes the JavaScript file I created and mentioned above:


<action method="addJs"><script>jQuery/sortselectbox.js</script></action>




In order to specifically fix the option order on this one configurable product I opened up that product in the Magento backend and inserted the following javascript into the product’s short description:


<script type="text/javascript">
jQuery(document).ready(function() {
  jQuery('#attribute965').sortOptionsByValue();
  jQuery('#attribute965').val('').attr({selected: 'selected'});
});
</script>




This script will sort the options by value alpha numerically (a-z0-9) and then it will put the empty option for “Choose an Option” as the first option and sets selected=”selected” on that option. From there you should be good to go. If you have a much more elegant method to resolving this feel free to let me know.