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

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -