Getting the name of a Twig template inside a Twig template

Published on 2023-02-18 • Modified on 2023-02-18

This snippet shows how to get the name of a Twig template inside a Twig template. Yes, this is inception! Not so hard as there is a special variable _self, for this purpose.


_self: <b>{{ _self }}</b>
HTML demo of the snippet
_self: snippet/code/_244_demo.html.twig

 More on Stackoverflow   Read the doc  More on the web  Random snippet

  Work with me!


Call to action

Did you like this post? You can help me back in several ways: (use the "reply" link on the right to comment or to contact me )

Thank you for reading! And see you soon on Strangebuzz! 😉

COil