Search code examples
twigshopware

What is the difference between base.html.twig and single-cms-page.html.twig?


The theme I currently deal with has two pretty similar files: /vendor/shopware/storefront/Resources/views/storefront/base.html.twig and /httpdocs/vendor/shopware/storefront/Resources/views/storefront/page/content/single-cms-page.html.twig.

Both seem to render the whole source code: <HTML><head>...</head><body>...</body></html>, with some differences in the content of single blocks.

They both don't seem to extend each other - single-cms-page.html.twig hasn't {% sw_extends '@Storefront/storefront/base.html.twig' %} and vice versa.

Q: In which cases frontend is rendered by base.html.twig and in which - single-cms-page.html.twig. Could somebody explain this? What is the sense of having these two files?


Solution

  • single-cms-page.html.twig seems to be used only for the Maintenance page, in \Shopware\Storefront\Controller\MaintenanceController::renderSinglePage it's more stripped-down and avoids accidentially rendering things other modules put into base.html.twig's blocks on the Maintenance page.