La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
No way to output hubL variables in JavaScript file?
Résolue
I'm trying to access {{ group.absolute_url }} within a Javascript file, but I'm unable to get any of the 'standard' variables to output anything. No matter which variable I try it comes up an empty string.
Is this unsupported within pure JS files? I'm needing it for some JS trickery around the tag filter, which doesn't seem to have its own section to execute JavaScript within as it's a standard module (Or so I assume). Is there another approach I can take here that would work?
No way to output hubL variables in JavaScript file?
Résolue
You can pass data to js through dataset though. Find a html element that you can target via javascript querySelector and attach the data to it. See below.
Another thing I have done to make this work is to set a localized global object where I can expose certain HUBL data for access inside modules.
Generally speaking, you wouldn't want to do too much of this, but its really helpful for common variables you might need access to in different contexts. I recommend doing this in the content settings <head> output.