Skip to content

Commit

Permalink
Backport of plusjade/jekyll-bootstrap#262 for website
Browse files Browse the repository at this point in the history
  • Loading branch information
bzz committed Sep 7, 2016
1 parent 9647ba4 commit 45bf884
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
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_classic" %}
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

0 comments on commit 45bf884

Please sign in to comment.