Load scripts using defer in <head> instead of putting them in the end of <body>#882
Conversation
Pull Request Test Coverage Report for Build 13869475438Details
💛 - Coveralls |
|
@kemchenj There is a small side-effect caused by this pull request: The hexo-theme-next/source/js/utils.js Lines 9 to 22 in 01bc42c However, the scripts loaded after |
Sure, I'll take a look at this weekend. |
I've tested with my blog site, in both Safari and Chrome, with and without cache, they all works as expected. But I can't find anywhere the |
|
@kemchenj Thanks! |
PR Checklist
PR Type
What is the current behavior?
Currently, most scripts are placed at the end of the
<body>tag.What is the new behavior?
This PR moves these scripts to the
<head>tag, utilizing thedeferattribute. This change enables earlier fetching of scripts, leading to improved overall page loading times.Given that the
deferattribute has been supported since IE 10, this change is expected to introduce minimal compatibility issues.