Using Layout Update to Place a Block in the Sidebar of Page in Magento 2

Using Layout Update to Place a Block in the Sidebar of Page in Magento 2

Posted by

In Magento 2, admin can place blocks in the left or right sidebar of a particular page through updating a layout to the XML code. Besides, admin is able to place the block in sidebar and even control its relative position with other blocks with just a few simple changes in code detail.

Sometimes, we use the term callout to refer to a block which is considered as a layout update with XML code. Also, the sidebar refers to the left or right columns of the page layout. When you enter layout update code, ensure to follow the syntax exactly as what the example shows.

 

To Place a Block in the Sidebar of a Page

  1. Open the admin sidebar and choose Content. Next, click on Blocks under Elements.
  2. Take a look at the grid to find the block you want to position and carefully take note its identifier. Check the spelling to make sure that there is no spelling mistake.
  3. On the Admin sidebar, click on Content. Next, under Elements, choose Pages.
  4. Determine the page where you want to place the block and open it in edit mode.
  5. In the board on the left, click on Design. Next, do the following:

a. In the Layout Update SML area, enter the code for determining the right or the left sidebar.

Code for CMS: Block in Sidebar

b. In Reference Name field, change to identify either the right or left column following the layout of the page.

c. In Block_id field, set up it to the identifier of the block which is being placed.

6. When complete, tap Save Page button in the upper right corner to finish.

 

Here is all the knowledge of Using Layout Update lesson we want to share. If you find it helpful for you, please Like, Share and Subscribe to keep updating for our coming blogs!

Leave a Reply

Your email address will not be published. Required fields are marked *