A variable inside an asset declaration in Twig
Use ~
for concatenation,
style="background-image: url({{ asset('bundles/testblog/images/' ~ variable ~ '.jpg') }});"
Also,
You don’t need to nest {{ ... }}
delimiters. The ones you used to wrap asset()
call are also used to print any other variable they contain.