From 987312af65aa4aee57b5c0cbbbf804cd171159ee Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 20 May 2020 10:17:56 +0200 Subject: [PATCH] Move Google Analytics to include, and prepare for making it optional Signed-off-by: Sebastiaan van Stijn --- _config.yml | 5 +++++ _includes/analytics/google_analytics.html | 7 +++++++ _includes/head.html | 8 +------- 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 _includes/analytics/google_analytics.html diff --git a/_config.yml b/_config.yml index b0a09e51e2..3748b4fad7 100644 --- a/_config.yml +++ b/_config.yml @@ -15,6 +15,11 @@ lsi: false keep_files: ["v17.06", "v18.03", "v18.09"] exclude: ["_scripts", "tests", "apidocs/layouts", "Gemfile", "hooks", "index.html", "404.html"] +# Google Analytics, etc. +# TODO these should only be set when building for production, or passed as an environment variable when building +google_analytics: GTM-WL2QLG5 + + # Component versions -- address like site.docker_ce_version # You can't have - characters in these for non-YAML reasons diff --git a/_includes/analytics/google_analytics.html b/_includes/analytics/google_analytics.html new file mode 100644 index 0000000000..3c538dc737 --- /dev/null +++ b/_includes/analytics/google_analytics.html @@ -0,0 +1,7 @@ +{% if include.GOOGLE_ID and include.GOOGLE_ID != '' %} + +{% else %}{% endif %} \ No newline at end of file diff --git a/_includes/head.html b/_includes/head.html index 1ab980be28..b3ae6c937c 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -16,13 +16,7 @@ display: block; } - - - + {% if site.google_analytics != '' %}{% include analytics/google_analytics.html GOOGLE_ID=site.google_analytics %}{% endif %} {% if site.GH_ENV == "gh_pages" %} {% endif %}