Server Details (Linux/Windows, Hosting service, etc) | DreamHost shared host |
PHP version | 7.1.22 FastCGI |
Platform (name and version) | Joomla! 3.9.6 |
Framework | Gantry 5.4.28 |
Template/Extension (name and version) | Xenon 1.3.6 |
Misc. | Site is only accessible over https |
We encountered some trouble loading a JS file using the Page Settings method, as described in
Gantry 5 docs, Advanced Theme Customization
. We added the directory site-root/templates/rt_xenon/custom/js and uploaded a file, hello-world.js, to the new directory. For the Outline in question, in Page Settings > Before </Body>, we added the snippet:
<script type="text/javascript" src="{{ url('gantry-theme://custom/js/hello-world.js') }}"></script>
When loading/reloading a page/item that is assigned the Outline, instead of the expected console.log output, we see
We've tried saving Page Settings with and without Body Classes (gantry) selected. This made no difference.
%7B, %20, and %7D are percent encoding for left brace, space and right brace, respectively. We tried changing the snippet to:
<script type="text/javascript" src="url('gantry-theme://custom/js/hello-world.js')"></script>
After saving the Outline and reloading the test page, we seeGET https://www.example.com/url('gantry-theme://custom/js/hello-world.js') 404 (Not Found)
If we change the snippet to:
<script type="text/javascript" src="gantry-theme://custom/js/hello-world.js"></script>
save the Outline and reload the page, we seeMixed Content: The page at '
www.example.com/item-alias
' was loaded over HTTPS, but requested an insecure script 'gantry-theme://custom/js/hello-world.js'. This request has been blocked; the content must be served over HTTPS.
If we change the snippet to:
<script type="text/javascript" src="/templates/rt_xenon/custom/js/hello-world.js"></script>
or
<script type="text/javascript" src="https://www.example.com/templates/rt_xenon/custom/js/hello-world.js"></script>
save the Outline and reload the page, we see the expected console.log output.
Any ideas why stream path/link URLs (e.g. gantry-theme://...) as shown in the documentation don't seem to work for us?