Optimizing Drupal for Page Speed

Making Drupal SEO Friendly

Requiring installation of third party modules

How to Improve Drupal Website Performance

August 12, 2023
By: RSH Web Editorial Staff

Contact Us

Optimizing Drupal
Menu

Drupal

Considered one of the best Content Management System (CMS). Over 1 million users globally are using Drupal to build some of the best and powerful websites. To maximize SEO with Drupal, you should first configure with the proper settings.

Optimizing Drupal

Let us start with Clean URLs and the Pathauto Module. These will give you the benefit of being able to control the use of keywords in each URL based on the title of the page
Install and Configure the Metatag Module You will need these for advanced configurations of HTML, Open Graph, Twitter Card, and Dublin Core meta tags required for social media and SERPs
Use GTmetrix Page Speed to test the site. Follow the recommendations for web-page performance according to this framework to fine tune the Drupal site settings
Use the Advanced Aggregation Module (AdvAgg). This module overrides Drupal’s core aggregation to compress CSS and JavaScript, providing more options to optimize for Page Speed.

With installing these modules - paying close attention to the configuration and settings, the core variable system can effectively generate complex metatag results for dynamic content without having to manually enter the information for every web page. By installing advanced aggregation of CSS and JavaScript, Drupal pages will consistently score high results on page speed tests.

Clean URLs

When installing Drupal, the CMS will automatically run a test to see if the server will support the use of Clean URLs. The main reason for this is to confirm that the “mod-rewrite” extension for Apache is available. Clean URLs will remove the “?q=” string that appears after the domain name on every Drupal page, and also allow for further customization of URLs with keywords based on the page title using the Pathauto module. The use of keywords in the URL is considered a major factor of the Google PageRank algorithm for categorizing the content of pages of search engine result pages (SERPs).

Sites that fail the Clean URL test on shared hosting can typically correct this by adding “RewriteBase /” to the .htaccess file. For more information on this process, visit the Drupal.org Clean URL page The only difference with Drupal 8 is that Clean URLs are enabled by default in the installation process and there is no admin section to disable them. For more information on configuring a web server to use Clean URLs with Drupal 8, visit this overview page on Drupal.org. The important point with Clean URLs is that they are just the starting point for maximizing SEO performance on a Drupal site with Pathauto.

Configuring the Pathauto Module for SEO

The installation process for the Pathauto Module, Metatag, & AdvAgg modules is standard: download the files from Drupal.org, unpack the zip files, and upload them to the server in the sites/all/modules folder or use Drush to install them with the command line. Enable each module in the Drupal administration section and check the permissions. (Note: Metatags requires both the CTools & Token modules)
The Pathauto Module can also be used to organize content for site programming, such as when placing dynamic blocks on a page according to content type.

There are only a few main values to consider with Pathauto, then the module will automatically translate the page titles of Drupal content into SEO Friendly URLs which are keyword rich for content searches. Navigate to the Pathauto configuration section and review the default settings, replacing any of the program variables using keywords.

CMS Hosting

Configuring the Metatag Module

When using the Metatag module with Drupal 7 and 8, the most important settings relate to the page title, canonical URL, and description. These meta tags determine what summary text will display for each page in the Search Engine's results page. The page description can be the same for all pages on a site, or set individually for each unique page. Because pages with a unique description will perform better in the SERPs, it is important to configure the description to be based on the teaser summary.

The Metatags module will integrate with views, and also allow for the custom setting of page descriptions according to content type. Best practice is to configure the page description for the homepage and main menu landing pages manually, then use Drupal systems variables to auto-write unique values for dynamic content. Use of the Dublin Core tags is considered optional. The module also allows for custom icons and favicons to be programmed through metatags for web apps and mobile.

Page Speed Tests

GTmetrix page speed is probably the best site to test the performance of your website and to ensure that all Search Engines are happy with your site. The page speed requirements are related to factors that go beyond the use of just metatags in HTML. GTmetrix tells you a lot about your website performance. Their Report gives you the full picture on how your site loads and helps you find problems.

Key features include:

Page Speed and YSlow scores and Recommendations
What is YSlow and How to Interpret Its Results?

Page Load Details (time, size, number of requests)
Designing for Performance. The Basics of Page Speed.

Various Analysis Options from Google
Make your web pages fast on all devices.

Waterfall, Video and Report History
10-Page Speed Tools to See How Fast Your Landing Pages Load.

Optimize the order of styles and scripts
How to Optimize Script and Style Sheet to Increase Page Speed.

Defer parsing of JavaScript
Instructions on How To Defer Parsing of JavaScript.

Inline Small JavaScript
The "Inline JavaScript" filter reduces the number of requests made by a web page.

Minify JavaScript
The 'Minify JavaScript' filter removes unnecessary bytes on the wire.

Minify CSS
Page Speed Optimization Filters. Minify CSS file contents, and if enabled, optimize or cache extend resources in CSS.

Specify a cache validator
.htaccess: How to “Specify a cache validator”?

Leverage browser caching
Page load times can be significantly improved by saving and reuse the files in your website.

Optimize images
Page speed is important for both rankings and user experience. Optimize images is one of the best ways to do this.

Minify HTML
Minifying your HTML can improve your page speed score, decrease your page’s render and load times, and reduce your overall page size.

Avoid bad requests
Autoptimize Avoid bad requests Errors.

Avoid landing page redirects
A landing page redirect can be defined as having more than one redirect from a URL to a final landing page.

Enable gzip compression
Website gzip compression makes it possible to reduce the file size of a web file, which will help with page loading times.

Enable Keep-Alive
HTTP Keep-Alive configures Servers to hold open a connection so that it can be reused to send multiple requests, thus reducing the overhead of loading a page.

Inline small CSS
Write small external CSS files directly into the HTML, removing the need for another roundtrip to the Server.

Minimize redirects
There are two ways redirects can affect speed: by adding to the server overhead or by delaying the load of the final destination.

Minimize request size
How to Reduce Your Website's HTTP Requests.

Put CSS in the document head
Improve site performance by inlining your CSS.

Serve resources from a consistent URL
Load identical files from the same source, to avoid duplication.

Serve scaled images
Images served on your page should be appropriately sized based on the dimensions they will be displayed at.

Combine images using CSS sprites
With a CSS Sprite generator, you can benefit from this performance optimization technique.

Avoid CSS @import
How to fix the Avoid CSS @import recommendation on GTmetrix Performance Report.

Prefer asynchronous resources
Loading scripts using async (asynchronous) means that the loading process of your scripts will not interrupt the rendering of your webpage.

Specify a character set early
Setting the character set at the server level reduces browser processing.

Specify image dimensions
Specify both the height and width attributes for images. If these are set, the space required for the image is reserved when the page is loaded.

Avoid a character set in the meta tag
How to fix the problem of Character set in the meta tag.

Specify a Vary: Accept-Encoding header
Understanding The HTTP Vary Header.

You should also use TinyJPG.com for better image compression of .jpg and .png images, which optimizes better than Adobe Photoshop.

For more advanced page caching than Drupal core provides, use the Views Content Cache module, Boost, or alternatively a solution with APC, Memcache, and Varnish.

Advanced CSS and JavaScript Aggregation

Use of the AdvAgg module with Drupal is standard and simple, but contains a wide range of settings that can be combined to optimize CMS performance for page speed. The AdvAgg module overrides the standard CSS and JavaScript aggregation in Drupal core and can be accessed through the “Performance” area of the CMS administration section. The main sections of the AdvAgg Module contain the settings for:
CSS and JavaScript compression
Third party compression plugins
Experimental applications
Change these settings to see which combinations work best for the website pages by visiting the GTmetrix page speed test again and using a feedback process to find the optimal combination. Another option is to use the Speedy module to replace the Drupal core JavaScript files with optimally compressed versions of the files. Speedy will also work well with the AdvAgg module, but needs to be updated with every Drupal core version change.

Summary

We hope this tutorial will help you create a fully optimized for SEO Website with a lot of flexibility. While some aspects of page speed will depend on the server environment, using advanced page caching, properly deploying CSS and JavaScript aggregation, and optimizing image files will significantly improve GTmetrix’s page speed test scores. Using the page description metatags, keyword-driven page titles in the URL structure, and using the various modules mentioned above should ensure optimal SEO configuration for a site that you built with Drupal.

RSH Web Services Drupal Hosting Include

FREE 1-Click Drupal Install
Drupal Migration
FREE Domain Name Registration or Transfer
Drupal Optimized Servers
Fast SSD RAID-10 Storage
FREE Enhanced Security
99.9% Service Uptime
45-Day Money-Back Guarantee
Free SSL Certificate
cPanel and Softaculous included.

We welcome your comments, questions, corrections and additional information relating to this article. Please be aware that off-topic comments will be deleted.
If you need specific help with your account, feel free to contact us anytime
Thank you

COMMENTS

Ryan A
Very nice.


Tomas B
Great explanation, I will share this, thank you.

Tweet  Share  Pin  Email.

More Articles Of Interest

We strive to be more than a web host. We are your partner in building a business that lasts. Since 1997 providing secure and reliable hosting solutions