-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve page rendering by deferring disqus loading #891
Merged
Conversation
This file contains 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
auto-assign
bot
requested review from
ivan-nginx,
maple3142,
sli1989 and
stevenjoezhang
June 1, 2019 17:03
How about disqusJS? #705 |
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
1v9
changed the title
Improved page rendering by deferring disqus loading
Improve page rendering by deferring disqus loading
Jun 4, 2019
@allcontributorsadd please add @KaitoHH for code |
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
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.js
for 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
*.js
for 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?