diff options
author | Jeffrey Tse <jeffreytse.mail@gmail.com> | 2023-08-03 22:19:38 +0800 |
---|---|---|
committer | Jeffrey Tse <jeffreytse.mail@gmail.com> | 2023-08-03 22:19:38 +0800 |
commit | a49acb6fc0c8aa2af42a63e1870f64a244633341 (patch) | |
tree | b5491a8343e15c097b96800ef31e4f7772b68b13 | |
parent | 997515d10e6d049672b49d24fd69ab302e293dec (diff) |
perf: reduce render-blocking scripts
-rw-r--r-- | _includes/extensions/code-highlight.html | 6 | ||||
-rw-r--r-- | _includes/extensions/comments/gitment.html | 2 | ||||
-rw-r--r-- | _includes/extensions/google-translate.html | 2 | ||||
-rw-r--r-- | _includes/extensions/mathjax.html | 2 | ||||
-rw-r--r-- | _includes/extensions/photo-swipe.html | 6 | ||||
-rw-r--r-- | _includes/extensions/trianglify.html | 2 |
6 files changed, 11 insertions, 9 deletions
diff --git a/_includes/extensions/code-highlight.html b/_includes/extensions/code-highlight.html index 22e40cc..b7c6399 100644 --- a/_includes/extensions/code-highlight.html +++ b/_includes/extensions/code-highlight.html @@ -1,9 +1,9 @@ -<link rel="stylesheet" - href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css"> +<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css"> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js"></script> <!-- and it's easy to individually load additional languages --> <script charset="UTF-8" - src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/languages/go.min.js"></script> + src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/languages/go.min.js" + async></script> {%- assign name = 'code_badge.enabled' -%} {%- include functions.html func='get_value' default='true' -%} diff --git a/_includes/extensions/comments/gitment.html b/_includes/extensions/comments/gitment.html index 8d90988..b3a8beb 100644 --- a/_includes/extensions/comments/gitment.html +++ b/_includes/extensions/comments/gitment.html @@ -1,6 +1,6 @@ <div id="gitment_thread"></div> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.css"/> - <script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.js"></script> + <script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.js" async></script> <script> var gitment = new Gitment({ id: '{{ page.id }}', diff --git a/_includes/extensions/google-translate.html b/_includes/extensions/google-translate.html index 9763315..830575a 100644 --- a/_includes/extensions/google-translate.html +++ b/_includes/extensions/google-translate.html @@ -105,4 +105,4 @@ function googleTranslateElementInit() { } </script> -<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> +<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" async></script> diff --git a/_includes/extensions/mathjax.html b/_includes/extensions/mathjax.html index 9ddd1ff..7d271e3 100644 --- a/_includes/extensions/mathjax.html +++ b/_includes/extensions/mathjax.html @@ -7,4 +7,4 @@ }); </script> <script -src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" type="text/javascript"></script> +src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" type="text/javascript" async></script> diff --git a/_includes/extensions/photo-swipe.html b/_includes/extensions/photo-swipe.html index 9a5a51c..99ea4f7 100644 --- a/_includes/extensions/photo-swipe.html +++ b/_includes/extensions/photo-swipe.html @@ -1,5 +1,7 @@ -<script src="//cdnjs.cloudflare.com/ajax/libs/photoswipe/5.3.7/umd/photoswipe-lightbox.umd.min.js"></script> -<script src="//cdnjs.cloudflare.com/ajax/libs/photoswipe/5.3.7/umd/photoswipe.umd.min.js"></script> +<script + src="//cdnjs.cloudflare.com/ajax/libs/photoswipe/5.3.7/umd/photoswipe-lightbox.umd.min.js" async></script> +<script + src="//cdnjs.cloudflare.com/ajax/libs/photoswipe/5.3.7/umd/photoswipe.umd.min.js" async></script> <link href="//cdnjs.cloudflare.com/ajax/libs/photoswipe/5.3.7/photoswipe.min.css" rel="stylesheet" diff --git a/_includes/extensions/trianglify.html b/_includes/extensions/trianglify.html index 74ddf87..99ca371 100644 --- a/_includes/extensions/trianglify.html +++ b/_includes/extensions/trianglify.html @@ -6,7 +6,7 @@ {% assign seed = include.seed %} {% endif %} -<script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/2.0.0/trianglify.min.js"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/2.0.0/trianglify.min.js" async></script> <script> function setRandomBgImage(selector, seed, zoom) { var element = document.querySelector(selector); |