There are a couple of ways to do this. If you’re hosting your site on GitHub then the best way is to wrap your code or HTML inside:

  
    {% if jekyll.environment == 'production' %}
      ...
    {% endif %}
  

GitHub creates this environment variable on its servers.

But what if you’re hosting somewhere else or your site is already compiled by the time it’s uploaded to the server? In this situation you can just check for your environment client-side:

  
  <script type="text/javascript">
    if (window.location.hostname == 'example.com') {
      // ...
    }
  </script>
  

Most people have Javascript turned on… and do you really care about bots? In fact this javascript method is great for including analytics that you don’t want running on your local development environment.

Kickstarter Coming January

I'm launching a board game called Delivery Duck. You're a duck, in a truck, delivering packages. It's a strategic family game for 2 to 6 players.

Check out the board game!