Browse Source

Use display=swap for Google Fonts

Using `display=swap` allows text to show up right away while waiting for the font to load, then swaps once it is finished.

You can see the type of difference this can make: https://www.webpagetest.org/video/compare.php?tests=200708_64_a5c3e57fdad44be3f5e98a618c78aca6%2C200708_7Y_27106d14550289c4ccc296ee0d819bbd&thumbSize=200&ival=100&end=visual
Joseph Scott 5 years ago
parent
commit
590cc5fde3
1 changed files with 1 additions and 0 deletions
  1. 1 0
      hever/functions.php

+ 1 - 0
hever/functions.php

@@ -141,6 +141,7 @@ function hever_fonts_url() {
 		$query_args = array(
 			'family' => urlencode( implode( '|', $font_families ) ),
 			'subset' => urlencode( 'latin,latin-ext' ),
+			'display' => 'swap'
 		);
 
 		$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );