diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-03-22 12:32:10 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-03-22 12:32:10 +0300 |
commit | 7b8f2865857b528b1f2b1e8e30fec2e6eafd8469 (patch) | |
tree | 3c695e1c31eafe04d740d31d96638b0e5761cccf /_includes/common/footer.html | |
parent | README: update (diff) | |
download | jekyll-theme-7b8f2865857b528b1f2b1e8e30fec2e6eafd8469.tar.gz jekyll-theme-7b8f2865857b528b1f2b1e8e30fec2e6eafd8469.zip |
get rid of custom_{css,js} in favour of a generic mechanism
Diffstat (limited to '')
-rw-r--r-- | _includes/common/footer.html | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/_includes/common/footer.html b/_includes/common/footer.html index 6fe7d65..e8fd04b 100644 --- a/_includes/common/footer.html +++ b/_includes/common/footer.html @@ -48,16 +48,28 @@ </div> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script src="{{ '/assets/bootstrap/js/bootstrap.min.js' | relative_url }}"></script> - {% if page.custom_js %} - {% for js in page.custom_js %} - {% assign abs_check = js | downcase | split: '//' %} - {% if abs_check[0] == 'http:' or abs_check[0] == 'https:' or abs_check[0] == blank %} - {% assign url = js %} + + {% assign scripts = '' | split: '' %} + {% if site.settings.scripts %} + {% assign scripts = scripts | concat: site.settings.scripts %} + {% endif %} + {% if page.scripts %} + {% assign scripts = scripts | concat: page.scripts %} + {% endif %} + + {% for script in scripts %} + {% assign abs_check = script.src | downcase | split: '//' %} + {% if abs_check[0] == 'http:' or abs_check[0] == 'https:' or abs_check[0] == '' %} + {% assign url = script.src %} + {% else %} + {% assign abs_check = script.src | slice: 0 %} + {% if abs_check == '/' %} + {% assign url = script.src %} {% else %} - {% assign url = '/assets/js/' | relative_url | append: js %} + {% assign url = script.src | relative_url %} {% endif %} - <script src="{{ url }}"></script> - {% endfor %} - {% endif %} + {% endif %} + <script src="{{ url }}"{% for attr in script %}{% if attr[0] == 'src' %}{% continue %}{% endif %} {{ attr[0] }}="{{ attr[1] }}"{% endfor %}></script> + {% endfor %} </body> </html> |