Optimizing a website

Once the website looks and functions they way you want it to it is time to optimize the website. This step is not mandatory. Your website will work well for 99% of all your visitors regardless of whether you optimize it or not. I do however recommend that you optimize the website none the less. Optimizing your website will make it easier to rank high in search engines and will make it load faster and run smoother. The faster your websites loads the better. Every second the website loads cost you visitors and customers. Loosing even one customer can cost you a lot of money.

A leaner code will also improve your code to content ratio which might help you rank higher in the search engines.

Enable Gzip and leveraged browser caching

Enable functions such as GZIP and leveraged browser caching to make the website load faster. You can activate these functions by editing your .htaccess files (If your using unix based hosting). Do a google search on how to enable these functions and you will find all the help you need.

Minimize & combine CSS

Try to make sure that your website only has one CSS file. If the website have several CSS file then it will require more connections to load and will take a longer time to render. You can manual copy the code from your different CSS document to one main document to combine all CSS documents. Once you created one file that contain all necessary code then you can remove the calls to the other CSS files to make sure that the website only use one file.

Once you have once master file you should minimize it. There are several tools online that will help you do this.

If you are using a theme that is developed by some one else then it is likely that the file contain a lot of unused CSS rules that you do not use on website. A common examples of this is themes that contains code for several different colour versions of the site in the file despite never using more than one version at a time. I recommend that you find the unused rules and remove them. It is often possible to cut the size of the CSS file in half by cleaning it up.

Minimize & combine Java

Most modern website use several java script files. Loading several files can slow down the load time and increase the time it takes before the website renders on the users screen. This can be avoided by combining java files into on single file. This is a little bit more complicated then combining CSS files since some Java script files require other java scripts to be loaded before they are loaded.

It is worth taking the time to combine all javascripts files (if possible) to reduce load times . You can find a number of different tools that can help you do this online. I am going to try to write an article on how to do this later but the topic is to complex to cover in this article. I recommend that do a google search about combining java files until such time that I have been able to write a guide about it. Once I do I will add a link to it here.

Defer loading images and scripts

Java scripts and images serve an important function on a website but they can also cause the website to load more slowly. I therefore recommend that you defer loading of images and scripts until after the website have rendered on the users screen. This means that they can start reading your article before the images and java scripts have loaded. The images and script functionalities are added to the websites as they load in the background. This can often shave a second or two of the load time of the website. It can save even longer for image and script heavy websites.

Defer java script improves the user experience.

And alternative to defer images is to use lazy load to only load a picture when a user scrolls down so that the image enters the screen. IE the website only loads visible parts of the website and waits to load other parts until you scroll down.

Anything you can do to make the website render quicker is worth doing.

Clean up platforms

If you use a CMS such as WordPress or other platform to build your website then it is likely that your website contains a lot of code that you do not need. Most platforms are built to be able to fill a lot of different functions for different users. Odds are that you will not be using all these functions. You should therefore look at the HTML output and see if the platforms includes code that you do not need on the website.

If we use WordPress an example then we find that the platform contain a lot of code that most users do not need. This includes code to be able to connect to the blog for remote editing, the emoji support and a number of other things. I recommend that you remove the code for all functions you do not need. If you use WordPress then there are a number of different plugins that can help you clean up the code even if you do not know anything about coding.