I found a topic about getting the current filename for templates here: How can I make a template output its own filename?

but I am curious, is there some way I can get the server to implement this across all templates without having to manually write it on each new template?

so that if I had

{# index.twig #}
{% extends "_layout" %}
{% block main %}
{% include 'inlude_one' %}
{% endblock %}

I might expect and output of

pathof index.twig
pathof _layout.twig
pathof include_one.twig
{# v rest of template v #}

For a bit of context, I wish to run a script to map templates to urls and I figure scraping for HTML comments might be a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.