Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
For a themer and potentially others, route name discoverable would be preferable over paths and making routes easier is key to this.
Proposed resolution
When twig_debug is turned on (or other debug/development variable), inject the page's route into a comment in the page template.
Remaining tasks
Create a patch to inject the page's route if available when twig_debuging.
User interface changes
n/a
API changes
n/a
Comments
Comment #1
dawehnerWould that information be print out in the beginning of the HTML, so for example in the page_top / page_bottom variable?
Just curious where you would expect it to be in general.
In general this is really a good idea!
Comment #2
joelpittetMy initial thought was 'page_top' but either or would be good. scripts bottom come after page_bottom so it wouldn't be as easy to just scroll to bottom.
Comment #3
dawehnerYeah the question is where would themers look at it.
In general the https://drupal.org/project/webprofiler already solves that problem in a different and more advanced
way, but for core this is a nice and simple improvement.
Comment #4
joelpittet@dawehner asking around a bit.
Comment #5
Fabianx CreditAttribution: Fabianx commentedI think we could just add it to either the page.html.twig or the html.html.twig at the top - near the twig debug output ...
That is where I would search for it ...
Comment #6
joelpittetComment #7
dawehnerJust as alternative idea, we could try to bring the webprofiler module with 8.1.x into core ...
Comment #10
joelpittetDoesn't need to be postponed any longer, could go into contrib