Support » Plugin: LiteSpeed Cache » LiteSpeed Google Font error

  • Resolved ben393

    (@ben393)


    When I have page optimization enabled, I have trouble getting my Google Fonts to load correctly.

    When logged out (cached), my site requests
    https://fonts.googleapis.com/css?family=XXX:wght@700&display=swap
    and my Google Font does not load in bold.

    When logged in (not cached), my site requests
    https://fonts.googleapis.com/css2?family=XXX:wght@700&display=swap
    and the font loads correctly. So the omission of the 2 in the Google Font URL is causing the font-weight error.

    But when I disabled Load Google Fonts Asynchronously to try to fix the issue, my page no longer requests the font library.

    My LiteSpeed report is YTCQRKRV.

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support qtwrk

    (@qtwrk)

    may I know where exactly did that css2? added ?

    Thread Starter ben393

    (@ben393)

    When LiteSpeed caches my page, a script requests the font:

    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin />
    <script>
      WebFontConfig={google:{families:["Bitter:wght@700"]}};if ( typeof WebFont === "object" && typeof WebFont.load === "function" ) { WebFont.load( WebFontConfig ); }
    </script>

    and the font doesn’t load correctly. When the page isn’t cached, my theme serves the font as a HTML <link>:

    <link rel='stylesheet' id='google-fonts-css' href='https://fonts.googleapis.com/css2?family=Bitter:wght@700&display=swap' type='text/css' media='print' onload='this.media="all"' />

    • This reply was modified 9 months, 4 weeks ago by ben393. Reason: formatting
    Plugin Support qtwrk

    (@qtwrk)

    please try set Font Display Optimization to default, purge all , see how it goes

    Thread Starter ben393

    (@ben393)

    My site was already set to this setting. But toggling this option on and off and purging all in between results in the same problem.

    Plugin Support qtwrk

    (@qtwrk)

    try turn off all CSS options , purge all

    Thread Starter ben393

    (@ben393)

    I think a conflict between my theme and the plugin was causing my issue. My theme had been configured to prevent Google Fonts from being render-blocking. Once I disabled this functionality, turning off Load Google Fonts Asynchronously in LiteSpeed fixed the issue.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘LiteSpeed Google Font error’ is closed to new replies.