Font, caching, loading font

For this site, I am noticing the font takes a second to load, so you see a flash of the default Times font before the sanserif loads.
I tried doing this:


But it didn’t do anything. Is this even solvable, or just something one has to accept?

Thanks!

I think your images are the bigger problem, they are huge.

1 Like

Thanks, yeah. The artist uploaded those before I gave instructions to compress the images beforehand.
Any advice on font loading / cache?

Fonts are cached by the browser. There are different font loading techniques to prevent FOUT, which you can find by googling. The most important is to use a good font stack with standard fonts that are as close as possible to the chosen web font to prevent the most ugly effects.

You could use https://github.com/medienbaecker/kirby-autoresize to keep your original images smaller.

But you can (should?) always resize the images in your templates:
<img src="<?= $img->resize(2000)->url() ?>">

Or use srcset, as @texnixe suggested in another thread.