Search A2Z 24

Question : Magento2 - How to show a block content on homepage

How to show a block content on homepage?

After install magento2 without sample data, I choose 'Magento Luma' theme and add 'Home Page Block' block and copy the code from the sample store.

but nothing show up on the home page, how to show my CMS block on home page like sample store?

My Home page :

sample store :

asked April 10, 2017

1 Answers

Dispalying 1 to 1 of 1 |

In admin panel go to Content->Pages and edit home page and if you created your static block from admin panel add following to the Content tab

{{block class="Magento\Cms\Block\Block" block_id="your_block_identifier"}}

and if you created a custom block using a module add following to home page content tab

{{block class="Vendor\ModuleName\Block\BlockName" template="Vendor_ModuleName::your_custom_block.phtml"}} 

then save the changes and flush magento cache and refresh home page if not come thendeploy/delete static contents now refresh home page see your expected result.

See comments (0) | Comment
Answered More than a year ago
Dispalying 1 to 1 of 1 |

Write your Answer write code <pre class="brush: xml">---code---</pre>

Login as a member to access answering block !! click-here

Reveal Modal Goodness

This is a default modal in all its glory, but any of the styles here can easily be changed in the CSS.

This is just a simple modal with the default styles, but any type of content can live in here. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi quis sem vel enim eleifend tristique. Etiam tincidunt faucibus pharetra.