I have create a custom xml for Category Page and I need to move the Category Title inside my Block. This is my custom.xml code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="page.top" >
            <block class="Magento\Cms\Block\Block" name="my.block" before="breadcrumbs">
                    <argument name="block_id" xsi:type="string">category-static-block</argument>

I try to use this but is not work

<move element="page.main.title" destination="my.block" before="-"/>


Also I have insert this in my custom static block:

{{block class="Magento\Framework\View\Element\Template" template="Magento_Catalog::mtitle.phtml"}}

in my mtitle.phtml I have add this code:

echo $block->getChildHtml('page.main.title');

and in the xml I have add this:

<move element="page.main.title" destination="my.block" before="-"/>

But without success ....

1 Answer 1


use getChildHtml('page.main.title'); to display it in your block "my.block"

echo $block->getChildHtml('page.main.title');

OR add it after tag

    <referenceBlock name="page.main.title">
    <action method="setPageTitle">
        <argument translate="true" name="title" xsi:type="string">My Title</argument>
  • Hi, thank you is not a phtml file is a static block
    – Robert
    Sep 20, 2021 at 8:36
  • please check I update my post, I try your idea but no success ...
    – Robert
    Sep 20, 2021 at 8:58
  • you want to change the page title right? Why do you want to move that title block to a custom block? Please explain a little more about what you are trying to achive Sep 20, 2021 at 9:27
  • is okay thank you
    – Robert
    Sep 20, 2021 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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