On Gantry 5 Documentation page
docs.gantry.org/gantry5/tutorials/particle-blocks
, it says "If you want a JavaScript asset to load just prior to the </body> tag of the page, you would exchange block javascript with block javascript_footer." But it seems not working.
Here's how I build a new 'Js' particle to hold the javascript files I wish to be loaded before the closing body tag:
YAML file(js.yaml):
name: Js
description: Loading JS before closing body tag
type: particle
form:
fields:
enabled:
type: input.checkbox
label: Enabled
description: Globally enable to the particles.
default: true
file:
type: input.filepicker
label: JS File
description: JS file to be loaded.
twig file(js.html.twig):
{% extends '@nucleus/partials/particle.html.twig' %}
{% block javascript_footer %}
<script src="{{ particle.file }}"></script>
{% endblock %}
This new created Js particle does appear in my particle list, I place it to copyright section, however, although the js file is successfully loaded, it is not before the closing body tag, rather it is before the closing div#g-page-surround tag, and outside of copyright section.
This image is hidden for guests.
Please log in or register to see it.
This image is hidden for guests.
Please log in or register to see it.
This image is hidden for guests.
Please log in or register to see it.