Magento 2 provides an XML Widget file that allows you to manage the page layout as well as place CMS Blocks at any position on the page. In the tutorial today, I will instruct you how to insert a Widget into Sidebar with two elements: “Configure a Widget” and “Configure a Layout Update”.
Widget is the awesome functionality you can insert to the CMS page from Magento 2 Configuration because it can be considered as a predefined set of configuration options. In the widget, you can add links that navigate diretly to any content page, category, or product as you need.
Content > Elements > Widgets.
Add New Widgetbutton.
Widget Titlefor the internal reference.
Assign to Store Viewfield or to any store view you want to apply the block.
Sort Orderif many blocks are placed at the same container. The block is at the top if the inserted value is zero.
Layout Updateto set the layout.
Widget Optionstab on the left panel.
Select Blockto choose the block from the list you want to place.
To insert the widget into sidebar, you need to make a layout update to the XML code by changing lightly in the code. Due to that, it is simple to place the CMS Block Static on right or left sidebar even or different positions on the page.
Content > Elements > Blocks.
Content > Elements > Pages.
On the left panel, select Design tab, in the
Layout Update XML box, insert the code for the right or left sidebar.
Code for CMS Block in Sidebar
<reference name="right"> <block type="cms/block" name="right.permanent.callout"> <action method="setBlockId"><block_id>your-block-id</block_ id></action> </block> </reference>
Save Pageto complete.
It comes to the end of the tutorial: How to Insert a Widget into Sidebar in Magento 2.
Posted by Linda in Content Management. June 23, 2018