Get list of Layout XML called for a current page Magento 2.

You can get a list of called Layout XML for specific pages by Magento\Framework\App\View class.

Call getLayout() method from Magento\Framework\App\View.php class.

getLayout()->getUpdate()->getHandles() used for getting all the handles of a page.

You need to keep below code at the end of root index.php file to check XML files.

To check for a specific page, You need to call like below way,

Call Inside a function,

// collect loaded handles for a current page
$loadedHandles = $this->view->getLayout()->getUpdate()->getHandles();

Now you can print the result $loadedHandles from above expression.

  • Example for a different Pages loaded handles:

For all the pages, default.xml is the first layout handle to call in a page and after that based on page handle, other XML layouts are rendering.

For Homepage,

For Product page,

Simple Product Page,

Configurable Product Page, 

Search Page,

Category Layered page,(Is Anchor Enable)

Non-Layered Page,

For Cart Page,

For Login page,

For About Us CMS Page,