Zach Minner
Drupal 8
Twig

Twig Function Cheatsheet

Cheatsheet for various twig functions in Drupal 8

Functions in Twig Templates Documentation

url()

{{ url('user.login') }} 

{{ url('user.pass') }} 

{{ url('user.register') }} 

{{ url('user.register', { 'destination': '<some-route>' }) }} 

{{ url('entity.user.canonical') }} 

{{ url('<current>') }}

{{ url('<front>') }}

path()

{{ path('view.frontpage.page_1') }}

{{ path('entity.user.canonical', {'user': user.id}) }}

{{ path('entity.node.canonical', {'node': node.id}) }}

{{ path('node.add', {'node_type' : '<node_type>'}) }}