diff --git a/Gemfile b/Gemfile index bce2436..2f6ba9a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,3 @@ source "https://rubygems.org" -gem 'github-pages' \ No newline at end of file +gem 'github-pages' +gem 'jekyll-environment-variables' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 3bf99b0..c1a3583 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -114,6 +114,8 @@ GEM rouge (~> 2) jekyll-default-layout (0.1.4) jekyll (~> 3.0) + jekyll-environment-variables (1.0.0) + jekyll (~> 3.0) jekyll-feed (0.11.0) jekyll (~> 3.3) jekyll-gist (1.5.0) @@ -243,6 +245,7 @@ PLATFORMS DEPENDENCIES github-pages + jekyll-environment-variables BUNDLED WITH 1.17.1 diff --git a/README.md b/README.md index befa523..05d6ff0 100755 --- a/README.md +++ b/README.md @@ -25,4 +25,4 @@ Serif is a beautiful small business theme for Jekyll. It contains content types To run the theme locally, navigate to the theme directory and run `bundle install` to install the dependencies, then run `jekyll serve` or `bundle exec jekyll serve` to start the Jekyll server. -I would recommend checking the [Deployment Methods](https://jekyllrb.com/docs/deployment-methods/) page on Jekyll website. \ No newline at end of file +I would recommend checking the [Deployment Methods](https://jekyllrb.com/docs/deployment-methods/) page on Jekyll website. diff --git a/_includes/google-analytics.html b/_includes/google-analytics.html index add9fff..aa8ad25 100644 --- a/_includes/google-analytics.html +++ b/_includes/google-analytics.html @@ -1,11 +1,31 @@ -{% if site.google_analytics_id %} - - - +{% if jekyll.environment == "production" %} + + {% assign gid = site.env.NETLIFY_GOOGLE_ANALYTICS_ID %} + {{ gid }} + + {% if gid %} + + + {% else %} + {% if site.google_analytics_id %} + + + {% endif %} + {% endif %} {% endif %} \ No newline at end of file