Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow `<head>` and footer scripts to be changed via config #1241
Common feature request is an easy way to add scripts to
Currently this can be done by adding custom
Simply add the full relative (or absolute) path(s) to relevant array and they will be added to the page.
head_scripts: - https://code.jquery.com/jquery-3.2.1.min.js - /assets/js/your-custom-head-script.js footer_scripts: - /assets/js/your-custom-footer-script.js
In the case of
Note: depending on the size of your site there may be a slight performance hit to build times as each of these config variables introduce
referenced this pull request
Sep 11, 2017
Good stuff! So a custom
footer_scripts: - /assets/js/vendor/jquery/jquery-1.12.4.min.js - /assets/js/plugins/jquery.fitvids.js - /assets/js/plugins/jquery.greedy-navigation.js - /assets/js/plugins/jquery.magnific-popup.js - /assets/js/plugins/jquery.smooth-scroll.min.js - /assets/js/_main.js
Great, so now anyone could do this to get a CDN-equivalent:
footer_scripts: - https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js - https://cdnjs.cloudflare.com/ajax/libs/fitvids/1.2.0/jquery.fitvids.min.js - /assets/js/plugins/jquery.greedy-navigation.js # didn't see a CDN for this - https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/jquery.magnific-popup.min.js - https://cdnjs.cloudflare.com/ajax/libs/jquery-smooth-scroll/1.7.2/jquery.smooth-scroll.min.js # - insert whatever custom script here to run before main - /assets/js/_main.js # - insert whatever custom script here to run after main
BTW, regarding the versions:
Not sure. You'll have to test.
If memory serves Magnific Popup had some CSS changes that I didn't want to mess with so I didn't bother updating.
Greedy nav had something I needed to override to fix a styling inconsistency.
The others I haven't looked at in a while.