Give your Drupal site an SEO makeover

Drupal LogoDrupal’s currently my content management system of choice. But like virtually any CMS, Drupal needs some SEO tuning to make it more attractive to search engines.

I’ve set up a number of websites using Drupal, and this post will gather together some of my standard actions for optimizing. I’ll try to be as exhaustive as possible on this post, starting with the basics and moving toward more complex optimization techniques.

This post, for the most part, looks at Drupal modules that can automate the SEO process for you. None of this negates the need to have an accessible theme design and to do the usual SEO activities such as building backlinks to your site. Let’s get started…

1) Enable clean URLs

First stop in any new Drupal site is to enable clean URLs. This gets rid of the querystring-based yoursite.com?q=/node/121 URLs and replaces them with something like yoursite.com/node/121 – Not only is it much nicer to look at, but it paves the way for the next step:

2) Install and Configure the Pathauto module

Pathauto automatically creates text-based URLs for your site, so instead of this being gerardmcgarry.com/node/121, it’ll actually be gerardmcgarry.com/blog/giving-drupal-site-seo-makeover. The logic behind this is that it will be more easily readable to the human eye, and it’ll also carry all the salient keywords from your page title, which makes it more attractive to search engines.

In-depth config: In its default state, Pathauto creates paths as content/title-of-your-post. However, with a bit of extra configuration, you can configure paths according to content type, so you have photo/statue-of-liberty and blog/state-of-the-economy. Go to Site Building -> URL Aliases -> Automated Alias Settings to fine tune how your URL Aliases are generated.

3) Install and Configure the Global Redirect module

While we’re working with path aliases, it’s a smart idea to install the Global Redirect module. Where Drupal is a little lackadaisical about URLs and duplicate content, Global Redirect works as an enforcer to ensure that all variants of an URL redirect to a single, authoritative URL. Without it, you’ll be able to access the same content at node/121 and blog/state-of-the-economy, which looks bad to search engines. It’s a simple function, but it can make a huge difference.

4) Install Nodewords module

They say meta data is dead, but even Google will use your Meta Description tag as a snippet in its search results. Installing the Nodewords module will automatically generate those meta tags directly from your content, saving you from having to create them manually with each page. You can also configure Nodewords to create a keywords meta tag from the taxonomy tags used in the post. It’s quite a powerful module than can be extended beyond what I’ve covered here, so take some time to delve into its possibilities.

Also try: Integrated metatags module – which has a very similar set of capabilities, but is slightly less intuitive to set up.

5) XML Sitemaps

Providing an XML Sitemap for your site is essential for content discovery. The XML Sitemap module will automatically generate a sitemap for you and ping the major search engines to notify them of new content. Install the module, configure it. No site, Drupal or otherwise should be without a sitemap these days.

Go further: Configure sitemap autodiscovery for your site by adding “SITEMAP: http://yoursite.com/sitemap.xml” to the end of your robots.txt file.

Even further: I sometimes configure the tracker in Drupal, and add the /tracker link as a “Latest posts” menu item. This creates a well-linked directory of virtually every node on your site, which means no files end up orphaned or overlooked, especially on more complex sites where not everything (Image nodes, Organic Groups, Wiki pages) are published on the front page.

6) Site verification

This works hand-in-hand with the XML Sitemaps module – if you’re a member of Google, Yahoo! or Bing’s various webmaster sites, you need to validate your site before they’ll give you stats and information about your site. The site verification module can handle both file and meta tag based methods of verifying your site with each search engine.

7) Google Analytics

Continuing our theme of interfacing with the search engines, you need to install some kind of visitor tracking to track where your visitors are coming from, what pages they’re viewing and the various other types of metrics that are important for monitoring your site’s growth.

I suggest Google Analytics because it’s easily become the industry standard. The Google Analytics module for Drupal inserts the tracking code without you needing to edit your theme, and gives you some nice configurable extras. Of course, you need a Google Analytics account in the first place, but those are free and easy to set up.

8) Nofollow for user-generated content

Any community site that allows the public to sign up and create content will undoubtedly be targetted by spammers to drop links. If your moderation skills are poor, and you allow unfiltered links to bad websites, Google in particular takes a dim view of your site and will demote you in search listings. You’ll lose traffic. You can sculpt this by using nofollow on user-generated links. You can set this up in Site Configuration -> Input Formats – enable the HTML Filter for your default input type and then enable the Spam Link Deterrent in there. This applies nofollow to all user-generated posts, including your own.

More sophisticated method! Instead of using the Spam Link Deterrent, install and configure the Nofollow List module. This allows you to block certain sites so that they have nofollow automatically applied. My preferred approach is to apply nofollow to all domains, and keep a whitelist of sites that are exampt from this. Instructions on configuring Nofollow List.

Either method will give you the added peace of mind of knowing that even if spammers are dropping links on your site, they’re not getting any search engine benefit from their nefarious activities.

9) Speed it up for better crawling

Yes, there’s a current school of thought that suggests Google now favours sites that load quickly. Even if Google’s plans to factor in page load times aren’t there yet, faster page loads are good for your users anyway. So, install the Boost module for static page caching, and enable features in Drupal like CSS aggregation to ensure your site serves pages as fast as possible.

What others say:

The are different schools of thought as to what works for a Drupal site and what doesn’t. Some people suggest using the Page Title module, others recommend the Search 404 module as part of an SEO strategy. There are recommendations for tools like Alinks or Glossify to create automatic backlinks within your site.

.htaccess tweaks

One technique which I think you should try is making sure your site is only available at either yoursite.com or http://www.yoursite.com. It kind of ties int
o the techniques for canonical URLs we talked about in the Global Redirect section. If your site is available with and without the “www” prefix, you have potential duplicate content issues and you could be diluting the value of your inbound links. Some people may link to the www version and some to the version without it.

First, check if your site is available at both addresses. If it is, find the .htaccess file at the root of your Drupal site and edit it. Scroll to the section that contains the rewrite rules and you’ll find sample code to redirect to the URL of your choosing. Read the instructions and uncomment the code of your choice, replacing the domain details with the domain of your site.

One word of warning – if you make changes to your .htaccess and/or robots.txt files, you have to be careful not to overwrite them when you upgrade your Drupal installation. When I download a Drupal upgrade, I tend to remove these files from the package so that they don’t overwrite the custom versions I’ve created.

14 comments

  1. Anyone with a big, frequently updated site should be leery of using XML sitemap. It can be a crippling performance problem. My site’s response time improved markedly after I turned it off. If you’re adding nodes every minute because you have a popular message board, you basically can’t use XML sitemap.

    • Not true anymore. The performance and scalability problems that plauged the 1.x versions are mostly addressed with the 2.x rewrite. We’ve had lots of reports of *large* sites using the module successfully.

      • Thanks for clearing that up Dave – when I initially saw that comment, I balked and wondered if Sitemaps might be causing performance problems. Needless to say, I have it installed on all my sites, and it works wonderfully.And it needs to be said, thanks for all your work on that module – you really kicked development up a notch or two!

  2. 10) Page Title. This module allows you to control the title that appears in the <HEAD> separately to the title that appears in the H1 & node links. This is incredibly useful for SEO as the title in the <HEAD> is the on that appears in SERPS (Search Engine Result Pages) and is one of the most important factors for SEO.

  3. I think you’ll find that nodewords can also also take care of your site verification codes for bing, yahoo and google. Saves you installing another module.

    • Yes it can do meta tags, but it cannot do file uploads. Site verification generally should be used whenever nodewords/metatags is not. But if you just want verifications, using nodewords/metatags is a much more extensive module than you’d need.

    • That’s a good point Wayne, and you’re absolutely spot on with that. I have a personal preference toward the file-based verification methods (if only to keep authentication details out of the HTML source). Nodewords will work just fine for this purpose.

  4. another great module is path redirect. this helps preventing 404 pages if you use it in relation with pathauto.when you change your title, path redirect will redirect the old alias to the new one.

    • Hi DalinI wanted to have a think about this one before replying. There are two instances where Global Redirect will come in useful. One of them on this particular site:When I originally built this site, I had no intention to do a whole raft of SEO stuff. I didn’t even enable Path and Pathauto. Therefore, after I eventually configured these modules, I had a lot of inbound links linking to node/123, and now these nodes have a path. So, links to those particular pages are split between node/123 and the new alias. Global Redirect will at least put this right.I have another site which uses Organic Groups. Now, when new content is added, OG sends notifications, but uses the basic node address. If the users were to grab these basic URLs and spread them around, once again, they’re splitting the value of those inbound links between two seperate pages. I don’t think it’s a holy grail of SEO, to be honest, but it does help. That’s why it’s further down my list.

  5. Dear all,
    What is the use of configuring and installing Global Redirect module..please can anybody explain
     
    Thanks

  6. I have read your site. Your site provide the information about How to Install and Configure the Global Redirect module, How Install and Configure the Pathauto module.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s