As seen in the section about page speed insights from Google, there are several issues of a technical nature that will show up when you assess your page speed. We will try to explain how to make sense of and solve some of these issues. However, if you feel that these are above your skill level, you may prefer to work with an expert on these problems.
Also, if you do not self-host your website and keep it on your website builder platform (e.g. Weebly, Wix, Squarespace), then you do not need to worry about any of the aspects described in this section. These web builder platforms also host the websites of their customers and usually do a very good job of ensuring that they load as fast as possible.
3.2.1 Defer or Async JavaScript files to eliminate render-blocking resources. We talked about render-blocking resources in Section 2.1. The browser loads elements and scripts in the order they are presented in the website files. First, it attempts to load the files in the <head> section. That’s where you usually find a lot of third party scripts belonging to the apps the website is using (e.g. analytics, ads services and many more).
The actual content in the <body> section has to wait for these scripts to be executed. This means that the visitor will not see any content until the apps in the header of the site are started. We already suggested using only those apps which are completely necessary and remove all others. What you can alternatively do is to “postpone” the loading of these scripts or “separate” them from the content.
If you have some basic knowledge of HTML, you can do this directly in the code of your website. If you add defer to the scripts that are slowing down the site (<script src=”scriptname.js” defer></script>), the browser will download them in the background, without blocking the content. If you add async (<script src=”scriptname.js” async></script>), the effect is similar, just that the script becomes completely independent from the rest of the page, loads separately, and is executed whenever it is done.
Alternatively, defer and async can be done using plugins/apps/extensions. In WordPress, there are plugins like Async JavaScript or others that will easily do this for you, without needing to know code.
Please note that working with these will affect the functionality of the website. You may need to undo some of the changes if parts of your page do not work as predicted.
3.2.2 Minify CSS and JavaScript. We already explained what minification is (deleting white space from the lines in your files). You would most likely not want to do this manually. If you have an HTML website and don’t use a CMS, one way to do it would be to use a tool like CSS Minifier, which will require you to input the original text in the CSS/JS files and obtain the minified result. Download the minified file and replace the old file with it.
Please note that if you will need to make changes to the files in the future, it will be a lot more difficult to work with the content of the files, as there will be a big chunk of text with no paragraphs and no spaces between words.
WP Fastest Cache and Fast Velocity Minify are two of the many plugins that offer minification for Wordpress websites.
3.2.3 Combine CSS and JS files
Your website may be using several CSS files that shape the styling of your page, as well as several JS files that dictate various actions and processes on it. The more complex the website (the more plugins/extensions/apps you have installed), the more CSS and JS files will run in the background. And the more of these files are, the longer it takes to load them.
Combining them automatically merges all of these files into a single one, so instead of as many as 30-40 CSS or JS files, there will only be one large file for CSS and one for JS. This will help the website load a lot faster.
Note: please back up the site before opting to combine files, as it may break some of the functionality and you may need to undo it.
Again, the apps or plugins that offer other page speed features (minification, caching etc.) should also offer the option to combine CSS and JS. If you don’t use a CMS and you handle the website code directly, there are options online to help you with combining your files.
3.2.4 Use CDN
A CDN (like our content delivery network) is a network of geographically distributed servers that can cache content and provide it faster to website visitors, depending on the location of these visitors. This can be especially important for websites that have a worldwide audience. Modern hosting providers offer CDN by default, being able to load the content from a node that is closer to the location of the user. This can make a big difference in terms of page load speed.
So, check to see if your hosting provider uses CDN and, if not, consider switching to one that does.