diff --git a/Rakefile b/Rakefile index f7918a4..b9b82de 100644 --- a/Rakefile +++ b/Rakefile @@ -7,7 +7,9 @@ task default: %w[build] desc "Build the site" task :build do config = Jekyll.configuration({ - url: Netlify.site_url + context: Netlify.context, + production?: Netlify.production?, + url: Netlify.site_url, }) site = Jekyll::Site.new(config) diff --git a/_includes/footer.html b/_includes/footer.html index b707bbf..cc92493 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -28,4 +28,8 @@ } -{% include analytics.html %} + + +{% if site.production? %} + {% include analytics.html %} +{% endif %} diff --git a/_lib/netlify.rb b/_lib/netlify.rb index a56021b..f695121 100644 --- a/_lib/netlify.rb +++ b/_lib/netlify.rb @@ -7,9 +7,11 @@ module Netlify end end - private - def self.production? - ENV["CONTEXT"] == "production" + context == "production" + end + + def self.context + ENV["CONTEXT"] end end