RSS Feed

Subscribe to Syndicate

Canonical URLs in Drupal - Being SEO friendly

The major search engines, i.e. Google, Microsoft's Bing and Yahoo have agreed on a standard tag that every web page should use to tell these engines what is its preferred version. This is called the canonical URL of a page, nicely explained in this article at Google Webmaster Tools Central Blog. The meta-tag should be added at the head section of your HTML page:

<link rel="canonical" href="http://www.example.com/content/title_of_your_story_or_page_here" />

Drupal default URLs are not friendly and are hard to read because they look like "http://www.example.com/?q=node/83". You can enable Drupal to produce the so called clean URLs (available in the standard installation) which looks like "http://www.example.com/node/83". Not much better, right?

I then found the Path Auto module which will produce much better URLs like "http://www.example.com/content/title_of_your_story_or_page_here" and are much more friendly.

Another useful tool is the XML Sitemap Module which will produce a sitemap.xml containing all your aliased URLs and still offer a functionality to submit that map to the major search engines. Tip: Remember to remove the Taxonomy (in case your are using those) pages from your sitemap to avoid being penalized by the search engines for duplicating content.

Well, you are not entirely set yet, because you need to set the above mentioned canonical URLs for your site. I found this module by yoast.com which is nothing more than a patched version of the Global Redirect Module that tries to add the canonical URL to the pages instead of throwing the 301 error back.

I found some comments that the yoast.com module had a bug, because it would only add the canonical meta-tag to the first alias created for a page, but I think this is the expected behavior of the module. In my case, as I used the Path Auto module only my ".../node/83" pages would get the canonical tag and the nice ones in the format "http://www.example.com/content/title_of_your_story_or_page_here" will not get the canonical tag, because this already is the canonical URL.

More tips on SEO optimization for Drupal right here.