Use twig to filter variable into url -
i have variable {{ name }}
outputs treatment & support. need remove & symbol , convert name useable url slug twig example: treatment-support.
i have having trouble finding correct twig fitlers. looking @ looking @ http://twig.sensiolabs.org/documentation. far have
{{ name |lower }}
to reiterate need use twig turn treatment & support treatment-support
using {{ name }}
variable.
any appreciated.
you can use twig replace filter :
{{ name|replace({' & ': '-', '&': '-'}) }}
as @darkbee said in comment, more complex, can use slugify
Comments
Post a Comment