Tips for (Static) Website Optimization

Too long, didn’t read
- Try to keep page load smaller than 50KB per request if you’re not dealing with images, a webpage should never be larger than a copy of Doom . Don’t add 10MB images to your site, generate thumbnails and compress them; link to the bigger images if needed.
- Try to serve progressive JPEG images and stay away from Google’s WebP format.
- Self-host everything.
- Use HTTPS if you have login forms, process user data and such.
- DO NOT use Javascript to manage links. Linking in HTML is a solved problem, don’t add an extra unnecessary layer.
- DO NOT track your website visitors or if you must do it, get consent.
- Load everything from the same domain or subdomain.
- Have a responsive design for your website as a lot of people use smartphones now.
- DO NOT geoblock your visitors.
- Keep in mind that some people have Javascript disabled in their browser; plan accordingly for a failsafe and do not greet them with a blank page. It’s rude.
- Inline critical CSS in a <style> tag.
- Try to inline images/js smaller than 4KB. Favicons are a good candidate for that.
- Minify and compress everything. Use gzip. Leverage browser caching.
- DO NOT override scroll events.
- Basically a webpage should load in 300ms or less.
- Please for the love of your favorite divinity do not use Cloudflare. Your visitors don’t need to prove they are not robots while robots get free access to your website anyway. Just don’t.
Let’s begin.


