浏览代码

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 年之前
父节点
当前提交
590cc5fde3
共有 1 个文件被更改,包括 1 次插入0 次删除
  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' );