How to SEO a Drupal Website

Drupal Search Engine Optimization.

How to SEO a Drupal Website

April 12, 2009 - James Andres

Drupal, even with a vanilla install, is highly search engine optimized. However, there are several modules that can help you increase the search engine friendliness of any Drupal installation. And lets face it, search engine traffic is by far the cheapest, and is the most effective: When someone searches for something in Google, they are ALREADY in the so-called "marketing funnel". Without further delay, this is what Work at Play developers do when they amp up the SEO of Drupal.

The Obvious

  • Enable Clean URLs
  • Enable and Configure Pathauto Module
  • Tweak .htaccess to redirect to "www" or remove the "www" subdomain (you just have to uncomment some lines in there, not scary)

Install Global Redirect Module

This module automatically redirect pages. It doesn't sound sexy, but it is. This is required when using pathauto as this will prevent access to non-aliased paths by redirecting them to aliased paths. For example, /node/1 will redirect to /about as above. Also does redirection from paths with ending slash, i.e. /node/ to /node. It does tonnes of other stuff too, read this page for the full details.

Install Page Title Module

Page Title Module is great. At it's most basic, it allows you to have much more control over your title tag (instead of always having it identical as what is in your h1 tag). When you appear in search engines results, the title tag is what searchers see, so it is great to have more control here. It also doesn't hurt that we can inject categories, authors, locations, etc to cram more relevant keywords into the title. Google loves that stuff.

Install Meta Tags (nodewords) Module

Despite what people tell you, meta tags are still heavily used by search engines. In the case of meta descriptions, this is the text that will usually appear as a summary of a search engine result. Look at this if you don't believe: Meta Description in Action This module is great because it will pick up taxonomy terms and cram them into meta keywords, it will jam a trimmed version of a node into meta description. It is well worth the overhead.

Install XMLSitemap Module

Holy Scary-Module-Name Batman. Bah - It ain't that bad. Here is the 411 right from the source sitemaps.org (put together by Google, Yahoo and M$)...

Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site. Web crawlers usually discover pages from links within the site and from other sites. Sitemaps supplement this data to allow crawlers that support Sitemaps to pick up all URLs in the Sitemap and learn about those URLs using the associated metadata. Using the Sitemap protocol does not guarantee that web pages are included in search engines, but provides hints for web crawlers to do a better job of crawling your site.

Cool - so, this module allows your Drupal website to "suggest" what Google should index next, and when to return to crawl again. XMLSitemap module is the base module for creating sitemap.xml. This is extensible (i.e. a developer can add their own links to the sitemap.xml). Simply implement hook_xmlsitemap_links to extend; see modules below for reference. XMLSitemap module has lots of "kid" modules. We usually activate the following modules:

XMLSitemap Nodes Module

Adds nodes to the sitemap.xml. It is only natural that you would want your new content to be indexed ;)

XMLSitemap Users Module

Adds user links to the sitemap.xml. Hopefully you've got some wicked user profiles and not that stock Drupal profile view (painful).

XMLSitemap Terms Module

Adds term (taxonomy) links to the sitemap.xml - do a little views integration and overriding to make these pages more "inviting".

XMLSitemap Search Engines Module

This is a sub-module for the XMLSitemap module. It can be configured at "admin/settings/xmlsitemap/engines". There are 3 generic options: 'Submit site map when updated' (recommended), 'Submit site map on cron run' (also recommended), and 'Submit site map when updated'. The rest of this module's setup is dependent on the search engine.

Submission Tips

Google First off, double check the Submission URL to make sure it is submitting the proper route for your site (in case it has a testing domain name or wrong subdomain). Second, go to https://www.google.com/webmasters and log in with the account you want to associate with your site. There will be a field to add your site to the account. Once the you add it, there will be a message telling you that your site has not being verified yet. When verifying your site you are provided with two options. Select the one that involves putting an html page in the route of the site, copy the page name it gives you (google########.html), and put this in the Verification link field of your XMLSitemap settings.

Yahoo

First off, double check the Submission URL to make sure it is submitting the proper route for your site (in case it has a testing domain name or wrong subdomain). Then navigate to http://siteexplorer.search.yahoo.com/submit and choose to submit your site; you will be required to login with a yahoo ID. Next, after you have submitted, go to the My Sites section in the navigation menu on the left. Here there is another place you must submit your site's url. After you have submitted it, click your site in the list and you will see an option in the left menu for authentication. There will be two options, one of which will be by downloading a file for the route of your site. Copy the name of the file and the unique string for its contents from the first step of this option and put them in the 'Verification link' and 'Authentication key' fields on your XMLSitemap form respectively. Once this is done, click the verification link on step 3 of Yahoo's instructions and they will queue your site up to be validated within the next 24 hours. You can also add URLs for site feeds in the feeds section for your site in the Yahoo Site Explorer interface.

Ask.com

Ask.com has no verification for submitting a sitemap. Simply double check the Submission URL to make sure it is submitting the proper route for your site (in case it has a testing domain name or wrong subdomain) and make sure to check the box to submit to Ask.

Install Robotstxt Module

Robots. They need to be controlled by humans. Haven't you seen the Matrix? Robots.txt allows you to do just that. Robotstxt Module is a useful base to dynamically create a robots.txt file. For Work at Play, we find ourselves using this module especially for multisite deployments.

Conclusion

SEO is an ever changing landscape. We'll update this post to stay relevant. But do yourself a favor and stay plugged in via the Drupal SEO Group, and also by keeping track of the lessons learned of others.