After upgrading a few of my Drupal 4.7 sites to the shiny new 5.0 distribution I felt the need to document my quest for search engine bliss. As content management systems go, Drupal is quite good out of the box (comes with sexy looking URLs built in) but some elbow grease is still required to enter search engine nirvana. It would be nice to have all of the modules and tweaks I have document below built right into Drupal core. After all, the best looking, fastest loading and most expensive website is useless if it can't be found in google.
Background to Search Engine Optimization (SEO)
I'm not going to go into a lot of detail about how search engines work and why some pages get ranked better than others, I'll leave that as an exercise for the reader :) I've added external links to some SEO terms and basic HTML definitions that I talk about in this article so if you're a total newbie then you may need to get a clicking. The most important search engine as of March 2007 is still Google so my notes are based upon my experience with Google. I realize however that some search engines may not use some of the items I list below to rank or index web pages but if you adding them won't hurt your rankings either.
What Google and other search engines want
Google ideally would like you to have the following items: (if you don't have em' your page will still get indexed but you may not get the results you want):
1) A TITLE tag: An example may look like this:

2) The Description Meta tag: In html speak an html meta description tag may look like the following:
Why use the Description Meta tag? Google use this in it's search results page as a description of your website under the blue heading. A good Meta Description is no longer than 150 characters and should be a short concise description of the content of the webpage. We'll be using the Nodewords module to generate description meta tags. See an example of how google uses the description meta tag in it's search results below:
3) A nice easy to read URL. An example of a not so nice URL would be www.mylittleportal.com/?q=lasodfnsodfon/dsafasdf6487632846832 - yikes! A nice, easy to read URL would look like www.mylittleportal.com/Drupal-SEO-tips.html. To satisfy this requirement we'll be using Drupal's "Enable Clean URLs" option. Google also likes sites that are laid out cleanly. A URL on a site that's laid out cleanly my look like this: www.MyLittlePortal.com/Outdoors/ - this is URL that points to a section on my website that list all Outdoor related articles. A poorly laid out site may use the following URL to jump to the same section: www.MyLittlePortal.com/taxonomy/term/6+5 - what URL would you rather be looking at?! We'll use the PathAuto Module to neaten up URLs on our site. An additional tweak albeit more complex is to make your URL point to just www.yourURL.com not yourURL.com, google supposedly prefers this - for this well edit the cryptic .htaccess file.
4) A way for a search engine to easily find all the pages on your website - we'll use a sitemap to satisfy this conditon. This will allow the search engine spiders (spiders are programs search engines use to slurp up all of your web pages into their database) to easily find all of your content. For this we'll use the SiteMenu module. We'll also use another module the XML Sitemap module that creates a fancier sitemap in accordance with the Sitemaps.org specification. It can optionally submit your sitemap to Google - excellent!
5) A robots.txt file in your root directory. My robots.txt file is more of a list of what I DON"T want google to index rather than what I do.
So now we know what Google and other search engines like let give them what they want!
Steps to make Drupal more search engine friendly
First, make sure the following items are enabled in your current Drupal install.
- Enable Clean URLs - This option makes Drupal emit "clean" URLs (i.e. without ?q= in the URL.) You can enable this module by going to yourWebsiteAddress.com/admin/settings/clean-urls.
- Enable Path module - Allows users to rename URLs. - this is very important of satisfying step 4 in the "What google wants" section above. As usual is hidden in the bowls of Drupal admin - hint take a look here: admin/build/modules
Now Install these additional modules
- Page Title Module - give all your pages title tags
Get it here
Once installed it can be administered here: admin/settings/page_title - Nodewords (Meta Tags) Module- description and keyword tags
Download the module here
The module may also be known under following names: nodewords or node (key)words. Meta tags is the preferred name.
Once installed it can be administered here: admin/content/nodewords - SiteMenu - an automatically generated site map page
Download the module here
Once installed it can be administered here: admin/settings/sitemenu - PathAuto Module - Used to Neaten up URLs
Get it here
Once installed it can be administered here: admin/settings/pathauto - XML Sitemap (formerly Google Sitemap)
Download the modulehere
Once installed it can be administered here: admin/settings/gsitemap
So you've installed the recommended modules above, now what?
I'll use the example of adding a new story to my website to show you how we can use the new modules and goodies we've just added. A new story is created by going to node/add/story. The first thing you'll notice when looking at the add story page is a new field below the Title field called Page Title. Add the text for your title tag here. (The name is a little confusing, it should be labeled Title Tag!)

Scroll down and below "Input Format" you see a place to put text for the Meta Description tag. Enter a description for you page, try not to excede 150 characters.

Scroll down further and you'll see the URL path setting field. Enter a descriptive name for your new page eg. my-new-page-about-fish.html may be appropriate if you like cod.

Your site should now also have a nice site map page thanks to sitemenu. It's a good idea to make this one of your navigation links on your home page so when the spidders come a crawling they can get to the sitemap page and ingest your website. You can see an example of what the site map page produced by the sitemenu module looks like at the the MyLittlePortal Site Map page. It's a thing of beauty as every time you add content to your Drupal site the sitemenu page will be automatically updated. Also note that the PathAuto has made my URLs nice and neat, here is an example of one that list all car reviw articles under the Auto category: www.mylittleportal.com/auto/car-reviews/
To use the XLM sitmap module with google you'll need a google account (email address). Go to this page at Google's webmaster tool section. I also suggest reading the INSTALL.TXT file that'll tell you how to use this module and get it talking to Google. Requires a bit more elbow grease that installing the other modules but you don't have to code it yourself right.
See an example of my robots.txt here.. Drupal allows pages to be served using a number of ways. You can specify the page my-little-page.html or the same page could be mylittleportal.com/node/22. It's better for the search engines to have just one name / reference for each page so we'll disallow them from going to anywhere they see /node/.
Now to make google happy we can also get all references of myLittleportal.com to point / redirect to www.mylittleportal.com. This will help as gets rid of duplicate content. Add this code to your .htaccess file. (there is code that is similar in the .htaccess file but it will direct everything that does not have a www prefix to your front page.) So just add the following two lines change the URL to that of your own website:
RewriteCond %{HTTP_HOST} ^mylittleportal\.com$ [NC]
RewriteRule ^(.*)$ http://www.mylittleportal.com/$1 [R=301,L]
Here is another article on Drupal SEO at Devbee.com - let's hope this link rockets you back into the coveted number 3 spot on Google mate! Be sure to read the comments people left regarding this article, there is a nice explanation of what pathauto really does (thanks TheWhippinpost). Here is another page with some more general SEO Tips. Here is a series of SEO articles from an Organic search optimization expertat IBM - a nice newbie read.
I've opened up comments on this article. Feel free to shamlessly promote your Drupal SEO articles too.
Delicious
Digg
Reddit
Technorati
MyLittlePortal.com is Richard's personal blog. Richard is a video producer and Drupal web developer living in Boulder, Colorado.
July 2, 2008 - 5:28am
I will remind you that main SEO people say to don´t use sitemaps.
They only help Google to analyse there own crawler. There are no benefits for your website.
March 17, 2008 - 9:23am
for some reason even though I have setup the description field for all my pages, it doesn't appear to be working for my index page, any ideas?
http://www.beyourownit.com
May 15, 2008 - 11:29am
Hey,
go to your admin>Site information> and put your website description in the "mission" section and hit save.
When you go back to your homepage refresh and view source and it will be there.
Hope this helped.
January 31, 2008 - 9:30pm
Very good guide thanks. I did not see mention of the Global Redirect module which is extremely important for avoiding duplicate content penalties. I wrote about it some at my Drupal SEO Guide.
August 21, 2007 - 8:37am
One possible complication of adding .html file extensions to your Drupal paths is that if you accidentally create a duplicate path, Drupal might rename it something like:
1st page: http://example.com/page-title.html
2nd page: http://example.com/page-title.html-0
If you use Pathauto to give the taxonomy pages .html filenames, when it paginates, it would do this:
http://example.com/term-name.html?page=2
A perspective from Tim Berners-Lee -- he recommends not using file name extensions:
http://www.w3.org/Provider/Style/URI ("What to leave out")
April 23, 2007 - 10:34pm
This article was really helpful to me. I've been working with Joomla and having some difficultly getting the SEO features working correctly. So, I decided to give Drupal another shot.
Within 15 minutes of reading your article and putting up some test content, I'm very happy with your suggestions.
Thanks again.
April 6, 2007 - 8:28am
Hi & thanks for the article. I noticed that you enter .html after your URL alias. I have only ever added a relevant word eg podcast for the node i'm editing. What's the advantage of entering podcasting.html, will search engines be tricked into thinking your site is a html site? One other point is that i added the sitemap module and no pages show up, does it only work with taxonomy terms?
Thanks
Alan - http://astralvoices.com
April 7, 2007 - 12:33pm
Alan, I'm not sure what advantage or disadvantage a .html suffix would have on a web page and it's ranking in Google. Looking at my sitemaps stats on Google Sitemaps page, it shows all my pages, those with .html and those without, as type text/html. I assume that Google gets this info from the first part of the web page (
March 29, 2007 - 2:50pm
Here is a quick round up of modules and tweaks we use.
http://ventureskills.wordpress.com/2007/03/29/drupal-seo-case-study/
March 29, 2007 - 12:07am
(No trackbacks?)
Good post.
My take on Drupal’s SEO modules - http://www.filination.com/tech/2007/03/28/drupal-seo-the-top-drupal-seo-modules-and-how-to-use-them/