diff --git a/_includes/head.html b/_includes/head.html index 3b99471f5ec5..c3da11a7c375 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -32,6 +32,10 @@ {% if site.head_scripts %} {% for script in site.head_scripts %} - + {% unless script.inline %} + + {% else %} + {{ script.inline }} + {% endunless -%} {% endfor %} {% endif %} diff --git a/_includes/scripts.html b/_includes/scripts.html index bbdaddff0bab..967f6f0e7d7d 100644 --- a/_includes/scripts.html +++ b/_includes/scripts.html @@ -1,6 +1,10 @@ {% if site.footer_scripts %} {% for script in site.footer_scripts %} - + {% unless script.inline %} + + {% else %} + {{ script.inline }} + {% endunless -%} {% endfor %} {% else %} @@ -23,6 +27,10 @@ {% if site.after_footer_scripts %} {% for script in site.after_footer_scripts %} - + {% unless script.inline %} + + {% else %} + {{ script.inline }} + {% endunless -%} {% endfor %} {% endif %} diff --git a/docs/_docs/05-configuration.md b/docs/_docs/05-configuration.md index 4ad70aaa30e8..5f344eaf34fb 100644 --- a/docs/_docs/05-configuration.md +++ b/docs/_docs/05-configuration.md @@ -202,8 +202,10 @@ For example, to add a CDN version of jQuery to page's head along with a custom s ```yaml head_scripts: - - https://code.jquery.com/jquery-3.2.1.min.js - - /assets/js/your-custom-head-script.js + - uri: https://code.jquery.com/jquery-3.4.1.min.js + attributes: > + integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous" + - uri: /assets/js/your-custom-head-script.js ``` Consult the [JavaScript documentation]({{ site.baseurl }}{% link _docs/17-javascript.md %}) for more information on working with theme scripts. diff --git a/docs/_docs/17-javascript.md b/docs/_docs/17-javascript.md index 3d8ad948e559..57f3a1a6202e 100644 --- a/docs/_docs/17-javascript.md +++ b/docs/_docs/17-javascript.md @@ -37,12 +37,23 @@ You can also add scripts to the `
` or closing `` elements by adding ```yaml head_scripts: - - https://code.jquery.com/jquery-3.3.1.min.js - - /assets/js/your-custom-head-script.js + - uri: https://code.jquery.com/jquery-3.4.1.min.js + attributes: > + integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous" + - uri: /assets/js/your-custom-head-script.js footer_scripts: - - /assets/js/your-custom-footer-script.js + inline: | + + + after_footer_scripts: - - /assets/js/custom-script-loads-after-footer.js + - uri: /assets/js/custom-script-loads-after-footer.js ``` **Note:** If you assign `footer_scripts` the theme's `/assets/js/main.min.js` file will be deactivated. This script includes jQuery and various other plugins that you'll need to find replacements for and include separately. diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index b785a622c20f..b4e51f1b9dd2 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -50,4 +50,4 @@ {% include scripts.html %}