(The following is an exceprt of a recent blog post by developer Andrew Menich. The full post provides significantly more detail.)
Websites are a lot like cars — if you take them into the shop for routine maintenance, they will last you a long time. It’s easy to let your website fall into this category of “if it’s not broke, don’t fix it.” While your website can’t get a flat tire, it can sometimes start to slow down or feel sluggish, so let’s take it into the shop and see what we can do to bring it back to peak performance.
First, does your entire website feel slow, or is it just slow on certain pages? Answering this question can help diagnose the problem and point to potential solutions. Whatever the case may be, identifying that the problem is localized to specific pages is valuable information before getting it fixed.
1. Only some of the pages on my site are slow
Here are some of the common causes and potential solutions when only some of the pages on your website are slow.
>> Images
Use modern formats like WebP and AVIF. These modern formats are made specifically for the web and deliver your photos at near-lossless compression for significantly less bandwidth than a traditional JPG or PNG format.
>> Background Videos
They slow down the initial page load, can distract users from your actual content, and can also have negative impacts on your site’s accessibility. The general consensus is that they probably aren’t worth it, so consider removing them entirely. If you’d prefer to keep one, make a few adjustments to keep its performance impact to a minimum.
>> Complex Logic / Filters + Sort Option
If you’re using Craft CMS, one of the first places to start in optimizing pages like this is to use eager-loading.
>> Embeds / iFrames
Most of the time these resources are not needed right away, so one solution to mitigate slow performance is to lazyload the embedded content. Lazyloading images works the same way it does for images as it simply waits until the embedded content is in view before downloading the resources required.
2. Nice try, but my whole site feels slow!
If it feels like your whole site is not performing as it should, we should examine what resources and other data are being loaded on each page. (Click here to read the full post, including specifics tips on how to handle each of the following areas:)
-
CSS
-
JavaScript
-
Fonts
-
Icon Fonts
-
Navigations / Other Global Site Elements
-
Caching
-
Tracking Scripts
-
Managing long-running processes
-
Web Server / Hosting
In Summary
When it comes to optimizing your website’s speed, there are a lot of factors and no single solution. Fortunately, almost all of these factors adhere to the principle of reducing the number and size of requests made by your website. Reduce the number and size of requests your website makes using the strategies above and you will be well on your way to a fast website.
Get all the tips. Read the blog post here.
|