I am creating a new custom theme for magento2.4.5. and to create a custom home page for base url (domain.com), I have done following:
In app/design/frontend/my-vendor/my-theme/Magento_Theme/layout/cms_index_index.xml (home.phtml contains the homepage html):
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="cms_page" display="false"/>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template"
name="homepage" template="Magento_Theme::html/home.phtml" before="-" />
</referenceContainer>
</body>
</page>
This code only works for main/url "www.domain.com". But when I open "www.domain.com/home url", it still shows the magento2 default home page content instead of my custom home page content. I can not use admin panel because this config needs to be saved with my custom theme.
What is the difference between "cms_index_index" and "cms_home" and how to load custom homepage for "cms_home" handle (www.domain.com/hom) as well? Please help.