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?

Kickstarter Coming September

I'm launching a board game. Put your email here to be notified on the launch!