Drupal and SEO

Dec 12, 2013 - by aram.p@ectostar.com

There are often SEO-related articles on Drupal blogs, but they mostly consist in listing all existing modules, without any comment, configuration tip or feedback about them. This post aims at changing that. We won't teach you how to do SEO, but we will show you how you can implement best practices using Drupal modules.

Drupal "core"

Without any additional module, Drupal is relatively limited : the only thing you can do is create URL aliases (using the "Path" core module) to transform system URLs (like "node/1") into human-readable URLs (like "terms-of-use"). This is something you really have to do.

Recommended modules


To fully use the URL aliasing mentioned above, Pathauto is the friend you need. URL aliases will now be automatically created using content items (title, menu trail, creation date...).

Pathauto comes with "content/[node:title]" as default configuration for content URL aliases, but at EctoStar we always override this. Here is the usual configuration we deploy on our projects (keep in mind we need to use Transliteration to avoid suppression of french accented letters):

    our default pattern for content is "[node:content-type:machine-name]/[node:title]". It allows us to organize URLs by content type and helps readers to understand the type of page they are on;
    for every content type where the date is a key information (news, events), the date is included in the pattern, such as "news/[node:created:custom:Y]/[node:created:custom:m]/[node:created:custom:d]/[node:title]" for example (in this specific case, removing any part of the URL brings the user to a View with date contextual filters, allowing us to systematically return a page with relevant content, whatever action the user does);
    for basic pages (terms of use, about us, and every other content mainly composed using a rich text editor), the pattern we use is "[node:menu-link:parents:join-path]/[node:title]". The URL will then exactly match the menu trail, again allowing users to access any page by manually removing a part of the URL (Jakob Nielsen calls these "hackable" URLs: http://www.nngroup.com/articles/url-as-ui/).


Historically done in Drupal 6 with the "Nodewords" module, Drupal 7 has had from the beginning a new "Meta tags Quick" module. Although it's good and working, a more powerful Metatag module has been released, and it's the one we recommend.

Apart from the standard META tags, the module can handle the TITLE tag (therefore suppressing the need of the "Page Title" module). With one of its sub-modules, you can properly implement OpenGraph / TwitterCards meta tags, allowing your websites to somewhat control the way pages are shared on the main social networks.

Default configuration of the module is good enough, but it can easily be adjusted on the configuration screen, either globally, for a dedicated content type or even for a specific content.

Possible modules


RobotsTxt allows you to control the "robots.txt" file (giving search engines crawling directives) directly in Drupal back-office. There isn't any point using it for a single website, its whole purpose is indeed to handle the robots.txt file independently for each site or domain of a multi-site installation.


Redirect creates URL redirects from a URL to another one. Mainly used during website migrations (to avoid breaking links pointing to old URLs), one of its additional features is that, by simply being activated, it automatically creates redirects when a URL alias is modified (that can happen when you are using Pathauto and change one of the URL item, often the title). This way you won't lose any user trying the old URL.

Schema.org implements the http://schema.org/ norm, which provides search engines with additional semantic information about your content. This sometimes changes the display of the results on these engines, making your website stand out among others.

Site Verification

Site Verification, although not directly impacting SEO, allows to add verification tags or files to connect your website to Bing / Google Webmaster Tools. Again it's especially useful for a multi-site setup.
Search 404

Search 404 allows to directly perform a search with URL keywords when the server returns a 404 error ("page not found"). It may redirect users towards an existing page if the search only returns one result. This prevents 404 errors on your website and spares some clicks to access a real page when using old URLs on your website (it is more for usability than SEO).

Other modules


To generate a sitemap.xml file, it's possible to use the XMLSitemap module. It works fine but is composed of several sub-modules, therefore the configuration is not always intuitive and you might end up with unexpected duplicates generated by XMLSitemap Menu and XMLSitemap Node modules. Also this module has sometimes been considered resource-consuming in the past. It has apparently improved now.

Our opinion is that on a modest website, the hierarchical organization of the content should guide search engines, so a sitemap.xml file only helps a poorly organized website. You should be able to avoid using this module completely.

On big website, the use of a sitemap.xml file is more appropriate, especially for long trail strategies. But it is totally possible to generate it externally, without loading Drupal with a bunch of modules. You can read more on this topic at http://technosophos.com/2010/02/15/5-differences-moving-xml-sitemap-modu....


Often mentioned or recommended in SEO module lists, GlobalRedirect redirects the user accessing a content using "node/1" URL towards its aliased version, such as "terms-of-use". If your website is correctly implemented using Drupal APIs, "node/1" should neither be directly displayed nor used. We therefore consider this module as a "hack" for poor design or development. Moreover, the Metatag module implements canonical tags indicating the correct version for a page, and it is possible to update the robots.txt file to avoid crawling some pages (such as node/*, user/*...). So you should not need the module anyway.

Site map

There is ability to generate a "sitemap" page with the site_map module since Drupal 5. For 2 years, MenuTree has been competing with it. Both work the same way, and none of them is currently efficiently maintained.


As you can see, there are numerous modules that directly implement some functionality and it is relatively easy to add SEO best practices to a Drupal website. That said, nothing will replace a relevant content for your visitors. Know your target audience and give them useful content. Have a clean technical implementation and the rest will come.


Leave a reply