1
0
mirror of https://github.com/danbee/danbarber.me synced 2025-03-04 08:59:10 +00:00

Limit analytics to production

This commit is contained in:
Daniel Barber 2018-08-12 09:52:30 -04:00
parent 799b370e39
commit f4b05b567e
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
3 changed files with 13 additions and 5 deletions

View File

@ -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)

View File

@ -28,4 +28,8 @@
}
</script>
{% include analytics.html %}
<!-- CONTEXT: {{ site.context }} -->
{% if site.production? %}
{% include analytics.html %}
{% endif %}

View File

@ -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