0

I want to move the product page title around a container div. I added the following to my catalog_product_view.xml file, but that does not add the div with class container.

What am I missing?

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="page.main.title">
            <container name="productpage.title" htmlTag="div" htmlClass="container" />
        </referenceContainer>
        <move element="page.main.title" destination="page.wrapper" before="main.content"/>
    </body>
</page>

Solution is:

<referenceBlock name="page.main.title">
            <arguments>
                <argument name="css_class" xsi:type="string">container</argument>
            </arguments>
</referenceBlock>
0

You did the mistake, first, you have to create container then you have to move.

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="{Referencecontainer}">
            <container name="productpage.title" htmlTag="div" htmlClass="container" />
        </referenceContainer>
    <move element="page.main.title" destination="productpage.title" />
    </body>
</page>
  • Thanks! Also tried that, but it still does not add the div around the page title. – Henk Z Jan 30 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.