[Neos] if query not working in section "bodyScripts"?

Christian Müller christian.mueller at typo3.org
Thu Dec 4 11:57:42 CET 2014


Hi Tina,

probably the node is not made available automatically to the template,
you can do it yourself in TypoScript, with:

page.body.javascripts.{yourKey}.node = ${node}

Then it should be fine. Replace {yourKey} with the key you used to add
this template with the JS.

Cheers,
Christian

Tina Eckhorst wrote:
> Hi,
> 
> I have a JavaScript that should only be executed in Frontend and not in
> Backend.
> I tried the following but the JavaScript is not loaded. Without the if
> query it's working but of course then it's also loaded in the Backend.
> 
> <f:section name="bodyScripts">
>  [...]
>  <script src="{f:uri.resource(path: 'JavaScript/main.js', package:
> 'TYPO3.NeosDemoTypo3Org')}"></script>
>  <f:if condition="{node.context.workspace.name} == 'live'">
>    <script src="{f:uri.resource(path: 'JavaScript/main-only-fe.js',
> package: 'TYPO3.NeosDemoTypo3Org')}"></script>
>  </f:if>
> </f:section>
> 
> Thanks!


More information about the Neos mailing list