laurilehmijoki / s3_website

Manage an S3 website: sync, deliver via CloudFront, benefit from advanced S3 website features.
Other
2.25k stars 186 forks source link

Setting jekyll.environment when building site #256

Open timmyomahony opened 7 years ago

timmyomahony commented 7 years ago

Is it possible to set the jekyll.environment variable when s3_website is building the site via s3_website push?

I've tried running JEKYLL_ENV=production s3_website push as well as setting JEKYLL_ENV=production in my .env file (which is otherwise working) but jekyll.environment still equals development when I check it in my templates.

I need it to add Google Analytics in my index.html:

{% if jekyll.environment == 'production' and site.google_analytics %}
  {% include google-analytics.html %}
{% endif %}
mkorneev commented 7 years ago

I guess you first need to run JEKYLL_ENV=production jekyll build and then s3_website push will do the job of publishing production version of your site.