Skip to content

Commit

Permalink
only load search JS if we're going to use it
Browse files Browse the repository at this point in the history
closes #130
  • Loading branch information
phette23 committed Jan 28, 2020
1 parent cf69244 commit 2a024dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@
</div>
</div>
</footer>
<script>var searchData = "{{ site.baseurl }}/search_data.json"</script>
<script src="{{ "/assets/js/lunr.min.js" | relative_url }}"></script>

<script>window.jQuery || document.write('<script src="{{ "/assets/js/vendor/jquery-1.11.2.min.js" | relative_url }}"><\/script>')</script>
<script src="{{ "/assets/js/vendor/bootstrap.min.js" | relative_url }}"></script>

<script src="{{ "/assets/js/main.js" | relative_url }}"></script>
<script src="{{ "/assets/js/search.js" | relative_url }}"></script>

{% if site.data.conf.search %}
<script>var searchData = "{{ site.baseurl }}/search_data.json"</script>
<script src="{{ "/assets/js/lunr.min.js" | relative_url }}"></script>
<script src="{{ "/assets/js/search.js" | relative_url }}"></script>
{% endif %}

{% if page.layout == 'proposedContent' %}
<script src="{{ "/assets/js/vendor/tabletop.js" | relative_url }}"></script>
Expand Down
2 changes: 2 additions & 0 deletions search_data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: null
---
{% if site.data.conf.search %}
{
{% for post in site.posts %}

Expand Down Expand Up @@ -56,3 +57,4 @@ layout: null

{% endfor %}
}
{% endif %}

0 comments on commit 2a024dd

Please sign in to comment.