Issue
- JavaScript added within the
<@liferay_aui.script>taglib inside a web content template executes twice, leading to unintended behavior. For example: -
<@liferay_aui.script use="aui-base,aui-video"> console.log("Hello world!"); </@liferay_aui.script> - The web content template is marked as non-cacheable.
Environment
- Liferay DXP 7.3.
Resolution
- There is currently no official solution for this issue, and it's not expected to be implemented in the future.
-
Fortunately, a quick workaround exists. Simply replace the taglib with the equivalent JavaScript code.
-
<script type="text/javascript"> AUI().use("aui-baser","aui-video", function(A){ console.log("Hello World!"); } ); </script> -
If possible, regardless of this issue, consider marking the template as cacheable for improved performance.