2

I am newcomer in Magento development, after 2 weeks I still feeling lost in the Magento 2 world.

I have added following Block to the app/design/frontend/Mojambe/LuarBiasa/Magento_Theme/layout/default.xml:

    <referenceContainer name="columns.top">
        <block class="Mojambe\Blog\Block\Html\MainImage" name="page.main.title" template="Mojambe_Blog::html/mainimage.phtml"/>
    </referenceContainer>

enter image description here

My proble is the block keep showing on all the pages when I only want it to show on the Home page only.

How to make a particular block only show on the particular page/url in magento 2.3 ?

I have tried this as well but still no luck:

enter image description here

enter image description here

Any help would be very appreciated.

1 Answer 1

1

Finally I got the Answer, to add a Block to particular page (in my case home page) just add following line in the page content:

<p>{{block class="Mojambe\Blog\Block\Html\MainImage" template="Mojambe_Blog::html/mainimage.phtml"}}</p>

Please don't confuse with widget, block use class instead off type in the property.

enter image description here

First line is Block and second line is Widget.

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.