CSP hash or nonce- dynamic generated in project

Please pay attention to best practices when creating modules:

In your case this means that the variable does not have to be set for every request, only when rendering the layout. (e.g. redirects and output other than HTML)


Another option is to create a custom view helper.