Skip to content

Commit

Permalink
make sure not to include jquery twice, fixes daattali#29
Browse files Browse the repository at this point in the history
  • Loading branch information
daattali authored and Adam Lamar committed Jan 31, 2016
1 parent 21387f1 commit 8904d0b
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions _includes/footer-scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
{% endfor %}
{% endif %}

{% if page.common-js %}
{% for js in page.common-js %}
<script src="{{ js | prepend: site.baseurl | replace: '//', '/' }}"></script>
{% endfor %}
{% endif %}

{% if page.ext-js %}
{% for js in page.ext-js %}
<script src="{{ js }}"></script>
Expand All @@ -22,4 +16,19 @@
{% endfor %}
{% endif %}

{% include google_analytics.html %}
{% if page.common-js %}
{% for js in page.common-js %}
<!-- doing something a bit funky here because I want to be careful not to include JQuery twice! -->
{% if js contains 'jquery' %}
<script>
if (typeof jQuery == 'undefined') {
document.write('<script src="{{ js | prepend: site.baseurl | replace: "//", "/" }}"></scr' + 'ipt>');
}
</script>
{% else %}
<script src="{{ js | prepend: site.baseurl | replace: '//', '/' }}"></script>
{% endif %}
{% endfor %}
{% endif %}

{% include google_analytics.html %}

0 comments on commit 8904d0b

Please sign in to comment.