diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html
index 9fafea69145..cf57d4cf3aa 100644
--- a/src/librustdoc/html/templates/page.html
+++ b/src/librustdoc/html/templates/page.html
@@ -20,6 +20,16 @@
> {#- -#}
{#- -#}
{#- -#}
+ {#- -#}
+ {%- for script in page.static_extra_scripts -%}
+ {#- -#}
+ {% endfor %}
+ {%- if layout.scrape_examples_extension -%}
+ {#- -#}
+ {%- endif -%}
+ {%- for script in page.extra_scripts -%}
+ {#- -#}
+ {% endfor %}