I want to add a title to a block with nothing more than layout xml, is there a generic class or block that I can use for this?

I've just tried page.title.main's class and template but it is too big and you can't pass a parameter for which html heading tag to use. Is there another? I cannot find it in the framework folder either.

    <block class="MyDesiredMAGENTOClass" name="account.navigation.title" template="html/title.phtml">
            <argument name="css_class" xsi:type="string">test</argument>
            <argument name="tag" xsi:type="string">h#</argument>

1 Answer 1


In the same layout.xml you can set the page title, here it is an example, in the head you set the title of the page, and in the block setPageTitle you set the title for the page. Hope it helps!

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>
        <title>My Title</title>
        <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">My Title</argument>
        <referenceContainer name="content">
            <!--Your content-->
  • 1
    I don't want to set the page title. Dec 15, 2016 at 15:47

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.