Skip to content

How can i render a block before ‘page-title-wrapper’ div

I want to render a block(phtml file) that contains a logo in <a> tag before the page-title-wrapper div. I wanted to do this in /sales/order/print/ page.

What I tried in my sales_order_print.xml file:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="sales_order_print_renderers" />
    <update handle="sales_order_item_price"/>
    <update handle="print" />
    <body>
        <referenceContainer name="page.main.title">
            <block class="MagentoFrameworkViewElementTemplate" name="custom.order.print.logo" template="Magento_Theme::invoice-logo.phtml" before="-" />
        </referenceContainer>
    </body>
</page>

page-title-wrapper div is something that is rendered by magento globally on every page, containing the page-title.

The logo shows up but it renders inside the page-title-wrapper instead of above it. I have attached the Screenshot below.

enter image description here

How can i bring the logo in <a> tag above/top of the page-title-wrapper div?