I recently came across Capo, a tool that helps identify HTML head elements that are out of order.
Using the Chrome extension, it offered a few suggestions for my project.
- Move the es-module-shims asynchronous script and
importmapsynchronous script to be a lot higher - All the synchronous styles
<link rel=stylesheet>to come before deferred scripts<script defer src> - Remove some
preloadelements which were having little to no effect (as the files were already discoverable by otherlinkelements) - Put everything else such as
meta, non-stylesheetlink, and JSONscriptelements last
You can see how Capo categorises all the elements into 11 groups on the docs rules page.