Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Site.Safe Replacement for Detecting Production Environment #262

Merged
merged 1 commit into from
Apr 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion _includes/JB/analytics
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% if site.safe and site.JB.analytics.provider and page.JB.analytics != false %}
{% include JB/is_production %}

{% if is_production and site.JB.analytics.provider and page.JB.analytics != false %}

{% case site.JB.analytics.provider %}
{% when "google" %}
Expand Down
3 changes: 2 additions & 1 deletion _includes/JB/comments-providers/disqus
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div id="disqus_thread"></div>
<script type="text/javascript">
{% if site.safe == false %}var disqus_developer = 1;{% endif %}
{% include JB/is_production %}
{% if is_production == false %}var disqus_developer = 1;{% endif %}
var disqus_shortname = '{{ site.JB.comments.disqus.short_name }}'; // required: replace example with your forum shortname
{% if page.wordpress_id %}var disqus_identifier = '{{page.wordpress_id}} {{site.production_url}}/?p={{page.wordpress_id}}';{% endif %}
/* * * DON'T EDIT BELOW THIS LINE * * */
Expand Down
39 changes: 39 additions & 0 deletions _includes/JB/is_production
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% capture jbcache %}{% comment %}

Determine whether or not the site is being built in a production environment.

Parameters:
None.

Returns:
is_production: [true|false]
jb_prod_env: [development|github|other]

Examples:

{% include JB/is_production %}

{% if is_production != true %}
<h3>This is Private</h3>
<p>I love to watch television in my undies. Don't tell anyone!</p>
{% endif %}

<h3>This is Public</h3>
<p>I have no unusual quirks.</p>

{% endcomment %}

{% assign is_production = false %}
{% assign jb_prod_env = "development" %}

{% if jekyll.environment != "development" %}
{% assign is_production = true %}
{% assign jb_prod_env = jekyll.environment %}
{% endif %}

{% if site.github %}
{% assign is_production = true %}
{% assign jb_prod_env = "github" %}
{% endif %}

{% endcapture %}{% assign jbcache = nil %}
3 changes: 2 additions & 1 deletion _includes/JB/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
<!--
- Dynamically set liquid variables for working with URLs/paths
-->
{% include JB/is_production %}
{% if site.JB.setup.provider == "custom" %}
{% include custom/setup %}
{% else %}
{% if site.safe and site.JB.BASE_PATH and site.JB.BASE_PATH != '' %}
{% if is_production and site.JB.BASE_PATH and site.JB.BASE_PATH != '' %}
{% assign BASE_PATH = site.JB.BASE_PATH %}
{% assign HOME_PATH = site.JB.BASE_PATH %}
{% else %}
Expand Down
3 changes: 2 additions & 1 deletion _includes/JB/sharing
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% if site.safe and site.JB.sharing.provider and page.JB.sharing != false %}
{% include JB/is_production %}
{% if is_production and site.JB.sharing.provider and page.JB.sharing != false %}

{% case site.JB.sharing.provider %}
{% when "custom" %}
Expand Down