forked from 18F/uswds-jekyll
-
Notifications
You must be signed in to change notification settings - Fork 22
/
scripts.html
41 lines (37 loc) · 1.39 KB
/
scripts.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{% assign _scripts = '' | split: '' %}
{% assign _async_marker = 'uswds_async=true' %}
{% assign _site_scripts = site.scripts %}
{% unless _site_scripts -%}
{% assign _uswds_js = '/assets/uswds/js/uswds.min.js' | append: '?' | append: _async_marker %}
{% assign _site_scripts = '' | split: ''
| push: _uswds_js %}
{% if site.anchor_js_targets %}
{% assign _anchor_js = '/assets/js/vendor/anchor.min.js' %}
{% assign _main_js = '/assets/js/main.js' %}
{% assign _site_scripts = _site_scripts
| push: _anchor_js
| push: _main_js %}
{% endif %}
{% endunless %}
{% assign _scripts = _scripts
| push: _site_scripts
| push: layout.scripts
| push: page.scripts
| uniq %}
{% for _script in _scripts %}
{% assign _src = _script.src | default: _script %}
{% if _src %}
<script src="{{ _src | replace: _async_marker, '' | relative_url }}"{% if _script.async or _src contains _async_marker %} async{% endif %}></script>
{% endif %}
{% endfor %}
{% if site.search_site_handle %}
<script type="text/javascript">
//<![CDATA[
var usasearch_config = { siteHandle:"{{ site.search_site_handle }}" };
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "//search.usa.gov/javascripts/remote.loader.js";
document.getElementsByTagName("head")[0].appendChild(script);
//]]>
</script>
{% endif %}