Category : current-page

I want get the current page and give an active class without duplicate code in symfony 5. Here is the code example : <li class="{{ app.request.get(‘_route_’)==’home’ ? ‘active’:”}}"> <a href="{{path(‘home’)}}">Home</a> </li> <li class="{{ app.request.get(‘_route_’)==’contact’ ? ‘active’:”}}"> <a href="{{path(‘contact’)}}">Contact</a> </li> </ul> Source: Symfony..

Read more