From fd97067ec3ffeffb6f069e05d3af16d4edc9181e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 1 Jul 2021 16:20:36 +0800 Subject: [PATCH] Optimize the JS loading priorities --- _includes/head.html | 7 +------ _includes/js-selector.html | 33 +++++++++++++++++++-------------- _layouts/default.html | 2 ++ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/_includes/head.html b/_includes/head.html index 1dfe049..62d3e29 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -62,13 +62,8 @@ {% include css-selector.html %} - + - - - {% include js-selector.html %} - diff --git a/_includes/js-selector.html b/_includes/js-selector.html index 42336bc..ff2f295 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -2,18 +2,34 @@ JS selector for site. --> + + + + +{% if jekyll.environment == 'production' %} + + + + + {% if site.google_analytics.id %} + {% include google-analytics.html %} + {% endif %} + +{% endif %} + + + {% if page.layout == 'home' or page.layout == 'post' %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} - + {% endif %} {% endif %} {% if page.layout == 'post' or page.layout == 'page' %} - + {% endif %} {% if page.layout == 'home' @@ -50,14 +66,3 @@ src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"> {% endif %} - -{% if jekyll.environment == 'production' %} - - - - - {% if site.google_analytics.id %} - {% include google-analytics.html %} - {% endif %} - -{% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index 79bfd37..a8c5709 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -46,6 +46,8 @@ layout: compress {% include search-loader.html %} + {% include js-selector.html %} +