With Magento there has been the possibility of displaying the path information in the frontend for ages. For this you used to go under system > Configuration > Advanced > developer > Debug.
In Magento 2 this has remained almost the same. Only now it's shops > Configuration > Advanced > developer > Debug.
Interestingly, the display does not work immediately after activation.

Basically there is a new setting in M2. With M1 and M2 you can make the display dependent on the IP. In addition, M2 also offers the option of activating “Enable Hints for Storefront with URL Parameter” a “code word” to agree, without the path references not appearing in the frontend. By default, this is “magento”. So if you want to have the path clues, one must “?templatehints=magento” append to the URL. If you change the code word, accordingly the changed word.
Deactivate this, should be assumed, that the path information is always displayed – in our version (2.4.2) but they didn't and you first had to add the appendix again. Only emptying the cache brought the display.