Your store homepage is a place where most of your visitors actually land. That's why adding as much information about your brand there is crucial. Testimonials, best sellers, new arrivals, brand story — you provide all the details here to make an impression. But don't forget that if you manage a blog, it deserves to be there too.
So in this guide, you'll learn how to add blog posts to the Magento homepage and homepage sidebar. The
makes the entire process super easy.Ready to start?
Post Contents [hide]
Add Recent Posts to Magento Homepage
You can add recent blog posts to the Magento homepage in two ways: through Magento widgets or directly into the CMS page content (using the widget tool). We'll go with the first option.
1. Navigate to Content > Widgets and click the Add Widget button.
2. Select Magefan Blog Extension - Recent Blog Posts as a widget Type, set the Design Theme and press the Continue button.
Note: you can display featured posts on the Magento homepage the same way. Just choose the Magefan Blog Extension - Featured Blog Posts widget.
3. Fill out the widget Storefront Properties.
- Set the Widget Title.
- Assign the recent blog posts to Store Views.
- Set the Sort Order to define the position of the widget on the list of widgets.
4. Fill out the Layout Updates options:
- Display on — defines what page to display the widget on (Specified Page).
- Page — defines a specific page (CMS Home Page).
- Container — defines a place on that specified page where you want to display your posts (Main Content Bottom).
5. Configure Widget Options.
That's where you define what posts to display on your homepage.
- Set the Title for the posts block that should be displayed on the storefront.
- Enable the Don't repeat posts option if you have multiple "Recent Blog Posts" widgets on the page and don't want posts to repeat within them.
- Specify the Number of Posts you want to display in the "Recent Blog Posts" widget.
- Choose whether to display posts from a specific Posts Category.
- Display blog posts by Post Tags if you want.
- Choose whether to display posts of a specific Posts Author.
- Define what to Sort posts By. It's Publish Date by default since you want to display the most recent posts here.
- Define specific time frame to display recent posts on Magento homepage by setting the Posts Publish Date From/To.
- Add Custom Template if you don't want to use the default ones.
Note: the Blog Extra plan offers you 22+ blog templates that apply to all blog lists, including post widgets.
Don't forget to Save the widget once you finish and check it out on the storefront.
Posts will change within the widget dynamically if you choose to sort them by date. This way only the latest pieces will be displayed on your homepage.
Recent Blog Posts on Porto Theme Homepage
If you have a Porto Theme and want to add recent blog posts to the homepage, add the following code to the homepage CMS page:
{
{block class="Magefan\Blog\Block\Widget\Recent" name="blog.home.recent" number_of_posts="8" custom_template="Magefan_Blog::widget/porto_theme_recent_home.phtml" title="FROM THE BLOG"}}Change the following if you need to:
- number_of_posts — the number of posts you want to display on the homepage
- title — name of the blog post block that will be displayed on the homepage
Add Recent Posts to Magento Homepage Sidebar
If your Magento homages has a sidebar, you can also add your posts there. For that:
1. Navigate to Content > Pages, then start editing the CMS Home Page.
2. Scroll down to the Design section and make sure the Layout is set to 2 columns with a left or right bar.
3. Paste the following code into the Layout Update XML field:
<referenceContainer name="sidebar.additional"> <block class="Magefan\Blog\Block\Sidebar\Recent" name="blog.sidebar.recent" template="sidebar/recent.phtml" after="wishlist_sidebar"> <action method="setCacheLifetime"> <argument name="time" xsi:type="string">86400</argument> </action> </block> </referenceContainer>
Save the page once you finish and flush the Magento cache to see changes reflected on your homepage sidebar.
Adding blog posts to your Magento homepage boosts engagement and provides customers with more options to choose. But that's not the only place where you can add your blog posts.
Since recent and featured blog posts are widgets, you can insert them into any content area: CMS page or block. Besides, you can even go as far as creating a custom blog homepage using these widgets. Ready to give it a go?