Make Fast Sites

64
@henshaw #pubcon Make Fast Sites Presented by: Jon Henshaw

Transcript of Make Fast Sites

Page 1: Make Fast Sites

@henshaw #pubcon

Make Fast SitesPresented by: Jon Henshaw

Page 2: Make Fast Sites

@henshaw #pubcon

Why do I need to make a fast site?

Page 3: Make Fast Sites

@henshaw #pubcon

Fast sites get more traffic

Page 4: Make Fast Sites

@henshaw #pubcon

Fast sites make more money

Page 5: Make Fast Sites

@henshaw #pubcon

“Cool! I’ll use AMP for that.”

Page 6: Make Fast Sites

@henshaw #pubcon

WAIT! 😱

Page 7: Make Fast Sites

@henshaw #pubcon

AMP is about Google, not you

Page 8: Make Fast Sites

@henshaw #pubcon

Do you get traffic from sites other than Google?

Page 9: Make Fast Sites

@henshaw #pubcon

Do you get direct traffic and share your URL offline?

Page 10: Make Fast Sites

@henshaw #pubcon

Do you like having control of your site?

Page 11: Make Fast Sites

@henshaw #pubcon

Did you know there was already a standard for web pages called HTML?

It makes AMP markup redundant and unnecessary

Page 12: Make Fast Sites

@henshaw #pubcon

You need a fast site, not AMP

Page 13: Make Fast Sites

@henshaw #pubcon

AMP is made for serving ads, faster

Page 14: Make Fast Sites

@henshaw #pubcon

Good UX is a conscious decision

Page 15: Make Fast Sites

@henshaw #pubcon

☑ Optimize code

Page 16: Make Fast Sites

@henshaw #pubcon

Identify and test which JS and CSS code is actually being used

Page 17: Make Fast Sites

@henshaw #pubcon

Conditionally serve code

Page 18: Make Fast Sites

@henshaw #pubcon

Consolidate JS and CSS code

Page 19: Make Fast Sites

@henshaw #pubcon

Use inline CSS and JS

Page 20: Make Fast Sites

@henshaw #pubcon

☑ Optimize fonts

Page 21: Make Fast Sites

@henshaw #pubcon

Google Fonts are great, but they can also slow down your site

Page 22: Make Fast Sites

@henshaw #pubcon

1.6 MB 😲

Page 23: Make Fast Sites

@henshaw #pubcon

Linked fonts should be used sparingly

Page 24: Make Fast Sites

@henshaw #pubcon

Consider using system fonts instead

body { font-family:-apple-system, BlinkMacSystemFont,"Segoe UI", "Roboto",

"Oxygen", "Ubuntu", "Cantarell","Fira Sans", "Droid Sans", "Helvetica Neue",sans-serif; }

Page 25: Make Fast Sites

@henshaw #pubcon

System fonts look great and are optimized for screens

Page 26: Make Fast Sites

@henshaw #pubcon

☑ Optimize Images

Page 27: Make Fast Sites

@henshaw #pubcon

Responsive images are not optimized images

Page 28: Make Fast Sites

@henshaw #pubcon

Optimization is serving a different image

Page 29: Make Fast Sites

@henshaw #pubcon

Do it with the SRCSET IMG attribute

Page 30: Make Fast Sites

@henshaw #pubcon

SRCSET can deliver smaller and different images to improve speed and UX

Page 31: Make Fast Sites

@henshaw #pubcon

Smaller versions for mobile

1024px800px

550px360px

Page 32: Make Fast Sites

@henshaw #pubcon

Different versions for mobile

Page 33: Make Fast Sites

@henshaw #pubcon

Versions optimized for UX

Mobile Desktop

Page 34: Make Fast Sites

@henshaw #pubcon

Regular IMG code

<img src=“cat.png” alt=“my cat”>

Page 35: Make Fast Sites

@henshaw #pubcon

SRCSET is an IMG attribute

<img src=“cat.png” alt=“my cat” srcset=“cat-hd.png 2x, cat-sm.png 320w, cat-sm-had.png 320w 2x, cat-med.png 768w, cat-med-hd.png 768 2x”>

Page 36: Make Fast Sites

@henshaw #pubcon

Specify device width

<img src=“cat.png” alt=“my cat” srcset=“cat-hd.png 2x, cat-sm.png 320w, cat-sm-had.png 320w 2x, cat-med.png 768w, cat-med-hd.png 768w 2x”>

Page 37: Make Fast Sites

@henshaw #pubcon

Specify Screen Resolution

<img src=“cat.png” alt=“my cat” srcset=“cat-hd.png 2x, cat-sm.png 320w, cat-sm-had.png 320w 2x, cat-med.png 768w, cat-med-hd.png 768w 2x”>

Page 38: Make Fast Sites

@henshaw #pubcon

WordPress supports SRCSET natively, but it doesn’t work if you want to use different images

Page 39: Make Fast Sites

@henshaw #pubcon

Reduce and compress image size

Page 40: Make Fast Sites

@henshaw #pubcon

Use SVG for simple images

and icons

Page 41: Make Fast Sites

@henshaw #pubcon

Use PNG for screenshots and

non-complex images

Page 42: Make Fast Sites

@henshaw #pubcon

Use JPG for photos and

complex images

Page 43: Make Fast Sites

@henshaw #pubcon

Compress with ImageOptim https://imageoptim.com/

Page 44: Make Fast Sites

@henshaw #pubcon

Compress with FileOptimizer https://coywolf.io/fileoptimizer

Page 45: Make Fast Sites

@henshaw #pubcon

EWWW Image Optimizer https://coywolf.io/ewww

Page 46: Make Fast Sites

@henshaw #pubcon

☑ Optimize Server-Side

Page 47: Make Fast Sites

@henshaw #pubcon

WP Rocket https://wp-rocket.me/

Page 48: Make Fast Sites

@henshaw #pubcon

Gzip via .htaccess

Page 49: Make Fast Sites

@henshaw #pubcon

Gzip via PHP

Page 50: Make Fast Sites

@henshaw #pubcon

Test Gzip https://coywolf.io/gziptest

Page 51: Make Fast Sites

@henshaw #pubcon

Gzip Resource https://coywolf.io/gzip

Page 52: Make Fast Sites

@henshaw #pubcon

Use a CDN and HTTP/2

Page 53: Make Fast Sites

@henshaw #pubcon

HTTP/1.1

Page 54: Make Fast Sites

@henshaw #pubcon

HTTP/2

Page 55: Make Fast Sites

@henshaw #pubcon

HTTP/2, CDN, Security, and SSL https://coywolf.io/freessl

Page 56: Make Fast Sites

@henshaw #pubcon

☑ Optimize UX

Page 57: Make Fast Sites

@henshaw #pubcon

A good UX is clear, focused and doesn't overwhelm the visitor

Page 58: Make Fast Sites

@henshaw #pubcon

Pages overloaded with content and numerous ads disorients the visitor.

Page 59: Make Fast Sites

@henshaw #pubcon

Focus on the primary purpose and consider a linear presentation of content

Page 60: Make Fast Sites

@henshaw #pubcon

Use Resource Hints to speed up navigation

Page 61: Make Fast Sites

@henshaw #pubcon

Use prefetch to load pages or resources in the background

<link rel="prefetch" href="/signup-form/ as="html"><link rel="prefetch" href="/js/script.js" as="script">

Page 62: Make Fast Sites

@henshaw #pubcon

Use prerender for pages you’re confident the user will visit next

<link rel="prerender" href="/tutorial/step-4/">

<link rel="prerender" href="/landingpage/">

Page 63: Make Fast Sites

@henshaw #pubcon

Adapted from https://makefastsites.com/

Page 64: Make Fast Sites

@henshaw #pubcon

My next big thing… https://coywolf.marketing/