From 7d128769f60aa26615c4ca60a6895f15116d8a0e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 27 Oct 2020 20:57:59 +0800 Subject: [PATCH] Avoid GA snippet blocking HTML parsing. --- _includes/js-selector.html | 18 +++++++----------- _layouts/default.html | 4 ++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/_includes/js-selector.html b/_includes/js-selector.html index ec5c9a8..62a36e6 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -8,38 +8,34 @@ {% if page.layout == 'home' %} - + {% elsif page.layout == 'post' %} - + {% if page.math %} - + {% endif %} {% elsif page.layout == 'page' %} {% if page.type == 'categories' %} - + {% else %} - + {% endif %} {% else %} - + {% endif %} {% if jekyll.environment == 'production' %} - - {% include google-analytics.html %} - - - + {% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index 03047bf..4b4b34c 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -54,6 +54,10 @@ layout: compress {% include search-loader.html %} + {% if site.google_analytics.id and jekyll.environment == 'production' %} + {% include google-analytics.html %} + {% endif %} +