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:
parent
799b370e39
commit
f4b05b567e
4
Rakefile
4
Rakefile
@ -7,7 +7,9 @@ task default: %w[build]
|
|||||||
desc "Build the site"
|
desc "Build the site"
|
||||||
task :build do
|
task :build do
|
||||||
config = Jekyll.configuration({
|
config = Jekyll.configuration({
|
||||||
url: Netlify.site_url
|
context: Netlify.context,
|
||||||
|
production?: Netlify.production?,
|
||||||
|
url: Netlify.site_url,
|
||||||
})
|
})
|
||||||
site = Jekyll::Site.new(config)
|
site = Jekyll::Site.new(config)
|
||||||
|
|
||||||
|
|||||||
@ -28,4 +28,8 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% include analytics.html %}
|
<!-- CONTEXT: {{ site.context }} -->
|
||||||
|
|
||||||
|
{% if site.production? %}
|
||||||
|
{% include analytics.html %}
|
||||||
|
{% endif %}
|
||||||
|
|||||||
@ -7,9 +7,11 @@ module Netlify
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def self.production?
|
def self.production?
|
||||||
ENV["CONTEXT"] == "production"
|
context == "production"
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.context
|
||||||
|
ENV["CONTEXT"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user