Problem/Motivation
Whilst Google Lighthouse can only give an indication of ways to improve page rendering times and we need to interpret the results it gives for ourselves, I was surprised to see it suggesting preloading the Metropolis-Regular typeface as this is used as the "default unless otherwise stated" in the html css selector.
It is also used in views of a node's teaser as part of the meta data (for example "Read more") which is likely to appear on the front page of many sites that are likely to use the Olivero theme. This type of meta data is likely to appear "above the fold", at least on desktop browsers.
Steps to reproduce
Create a default Olivero instance and fill it with a few articles. Note the the front page will no contain several instances of the Metropolis-Regular typeface and that Google Lighthouse will suggest preloading this.
Proposed resolution
Add Metropolis-Regular to the short list of preloaded resources by adding it to the core/themes/olivero/templates/includes/preload.twig file.
Remaining tasks
User interface changes
none, other than hopefully slightly faster renderings of the page!
API changes
none
Data model changes
none
Release notes snippet
none
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | preload-WebPageTest_-_Visual_Comparison.png | 202.53 KB | mherchel |
| #11 | normal-WebPageTest_-_Visual_Comparison.png | 200 KB | mherchel |
Issue fork drupal-3197721
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3197721-preload-the-metropolis-regular
changes, plain diff MR !309
Comments
Comment #2
rachel_norfolk** Please note I'm going to work with a new contributor on this today, 10 Feb, if you can all give me a chance to do that before jumping in with an issue fork! :-)
Comment #4
Poppy_Norfolk commentedI am working to make a new. issue fork.
Comment #5
rachel_norfolkExcellent! We will come back to this at 1500utc tomorrow.
(In case anyone is intrigued why we are going through this so slowly for a one-line fix, I'm helping my goddaughter work through this step-by-step as a totally new Drupal user so I can see all of the hurdles a new contributor faces - and hopefully try and reduce some of those hurdles. Therefore, until we get to "Needs Review" I really need to watch every step...)
Comment #6
mherchelThanks for taking this on @Poppy_Norfolk.
Note that I'm preloading fonts that appear "above the fold". The "meta" section of node teasers and full display modes do use the "regular" variant of Metropolis, so this should probably be added.
However, once we get a patch for this, I'll want to test this out (via webpagetest), to make sure it works as expected and the request doesn't displace anything else.
Comment #8
Poppy_Norfolk commentedWe have added the font to preload.twig
Comment #9
rachel_norfolkHeh - I don't need to lean over Poppy's shoulder any more! (removes self-assignment)
Comment #10
mherchelComment #11
mherchelThis looks great to me!
Normal (no patch)
Metropolis normal preloaded
Comment #12
alexpottDiscussed with @lauriii and we are both +1.
Committed and pushed 0e7e67f75d to 9.2.x and 0b9972b15b to 9.1.x. Thanks!
Backported to 9.1.x since olivero is experimental.