Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit dc41709

Browse files
authored
Merge pull request #75 from readthedocs/davidfischer/async-js-improvements
Make JS async where possible
2 parents a63c1e0 + 5fe064c commit dc41709

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

readthedocs_ext/_templates/readthedocs-insert.html.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ READTHEDOCS_DATA['source_suffix'] = {{ page_source_suffix|tojson }}
2828
{%- endif %}
2929
</script>
3030

31-
<script type="text/javascript" src="{{ rtd_analytics_url }}"></script>
31+
<script type="text/javascript" src="{{ rtd_analytics_url }}" async="async"></script>
3232

3333
<!-- end RTD <extrahead> -->

readthedocs_ext/readthedocs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ def finalize_media(app):
6565
if sphinx.version_info < (1, 8):
6666
app.builder.script_files.append(js_file)
6767
else:
68-
app.add_js_file(js_file)
68+
kwargs = {'async': 'async'} # Workaround reserved word in Py3.7
69+
app.add_js_file(js_file, **kwargs)
6970

7071

7172
def update_body(app, pagename, templatename, context, doctree):

0 commit comments

Comments
 (0)