Improve page rendering by deferring disqus loading#891
Merged
1v9 merged 2 commits intotheme-next:masterfrom Jun 4, 2019
Merged
Improve page rendering by deferring disqus loading#8911v9 merged 2 commits intotheme-next:masterfrom
1v9 merged 2 commits intotheme-next:masterfrom
Conversation
Contributor
|
How about disqusJS? #705 |
Contributor
Author
|
Fixed. Notice that DisqusJS also has the same problem as #395. So I fixed it by adding essential url and identifier attribute. hexo-theme-next/layout/_third-party/comments/disqusjs.swig Lines 18 to 19 in 98c3083 |
ivan-nginx
approved these changes
Jun 2, 2019
1v9
approved these changes
Jun 2, 2019
Member
|
@allcontributorsadd please add @KaitoHH for code |
Contributor
|
I've put up a pull request to add @KaitoHH! 🎉 |
tongluyang
pushed a commit
to tongluyang/hexo-theme-next
that referenced
this pull request
Nov 19, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The whole web page is blocked and shows nothing until loading
embed.jsfor Disqus is completed. Things get worse when some users (especially those Chinese users) have trouble connecting Disqus since they will see a blank page for a long time until the requested timeout.In addition, for those who enable
pace.js, they will see the progress bar circling for a long time until timeout.What is the new behavior?
The main cause of this problem is that loading
*.jsfor Disqus blocks the rendering of the whole web page, so I simply defer the js loading until the whole page loading is completed.hexo-theme-next/layout/_third-party/comments/disqus.swig
Line 10 in 54a04c6
Here I use window.onload callback function instead of directly inserting script tag to prevent blocking the whole web page.
Does this PR introduce a breaking change?