How to use Magento 2 static blocks
Content Management system plays an indispensable role in creating and managing content for any website. One of its distinguishable qualities is that it makes content handling easier for a non-technical user. The global CMS market is valued at USD $62.4 Billion in 2020 and is estimated to grow around USD $116.2 Billion by 2025. Yet it is not always easy to control it as one desires. Admins usually are a handful on content handling and therefore it sometimes becomes uncontrollable if not dealt vigilantly.
Static blocks make up the majority of the content that is on a website. Block is basically a modular unit based on varying sorts of content that can be positioned anywhere on a website. They are most commonly referred to as static blocks or CMS blocks. They could be defined as reusable pieces of information that can be displayed using a widget or a short code. Fixed Information like text, images, embedded videos make part of a static block. Most elements on a website are blocks that can be easily managed and re-positioned through the admin panel. Both blocks and widgets can be considered as key layout features of Magento and are mostly positioned in footers, sidebars and headers.
Widgets play a pivotal role in the overall Magento development. They provide crucial front end and back-end functionality. It is mostly used for adding targeted content and enables store administrators to add static as well as dynamic blocks. To sum up, it provides both developers and administrators a great opportunity to add interactive interfaces despite having little to no knowledge of coding.
Magento 2 WYSIWYG Editor:
WYSIWYG (‘what you see is what you get’) Editor is an add-in used to edit content at the back end. People unable to handle content editing through HTML can use this editor. Most importantly it provides features to use Magento 2 static blocks.
How to enable/disable Magento 2 WYSIWYG Editor?
In order to enable the editor, go to the Admin Panel, click stores and then Configuration. After that, change to General and then content Management. A page layout under configuration pops up. Although, the editor is enabled by default and if not uncheck the “Use system value” box and select “Enabled by default” under the “Enable WYSIWYG Editor”. With that being done save the configuration, clear cache and then refresh. The editor will be enabled.
Some benefits of advanced Static Block function:
When it comes to the default Static block in Magento there is a certain limitation to not being able to customize information for specific users. This hampers the overall shopping experience. However, with the recent advancement in Static block function, each customer group can be exposed to information that is more relevant and relatable. Store admins can show unique and sensitive block content to a specific group of customers. For instance, some block content like Refund policies, affiliate policies should only be shown to wholesalers or affiliate customers only.
Create Magento 2 static blocks/Display in different areas:
Moving on, we’ll be covering to major key points in How to use Static blocks in Magento 2:
1. How to create CMS blocks in Magento
2. How to display static block in different areas
For starters one should know that blocks are like mini-pages. After creating a block, widgets are used to place them on multiple pages. One can either do the following:
· Create a CMS block on a category page to notify the customer
· Add a static block to a CMS page
· Add it to another CMS block to diversify the content page
In case the store administrator doesn’t want to spend much time then he can call a static block using a PHTML file or by using the xml file layout. However, these are only for front end developers and will not be covered in much detail for now.
How to create CMS blocks in Magento 2.0:
To create CMS blocks in Magento 2.0 follow the below stated steps:
· Step 1:
In the admin panel, go to Content and then under Elements click on Blocks. A page layout by the name Blocks pops up. This page basically displays all the static blocks that have been created since the store has been set up with every detail related to their titles and date modified etc. is written down. On the upper-right corner click on “Add New Block”.
· Step 2:
A new page layout by the name “New Block” pops up. Here enter all the relevant details. This page includes a block title which is a title needed for internal reference. Also, an identifier which serves as the unique identifier for the block title. It should be in lower case and make sure it’s written with underscores. After this, select the store view where the block is to be displayed. Finally, moving to the most important feature of the layout which is the editor. Here one can format text, images, videos and can also add HTML links through “Show/Hide editor” if one prefers to work with codes.
Finally, Click save and close.
Display Static Block in different areas:
In this article we’ll be discussing only two different areas that explain how to use static blocks in Magento 2.0. First, by placing it on a category page and then using widgets.
1. Display Static block on a category page:
· Start off by clicking logging into the Magento, click on Catalogue categories. Choose the category in which you want to add the static block.
· Once chosen, go to the content section of that category and choose the static block you want to display using the “Add CMS Block” option. Secondly, using the display settings choose the display mode either you want to display just the static blocks or both the products and static blocks. Finally, click on Save and refresh.
2. Display using widgets:
· Click on Content and then go to widgets. Choose “Add widgets” a page layout by the name Widgets will open. Here, add “Type” as CMS Static blocks, choose the design theme as per desire. Click on Continue.
· After this, in the Storefront properties add the widget “Title” and then choose where you want to view it either on all stores or a specific page.
· Enter the sort order which displays it in order in the list of widgets. This is a very important step since it helps in selecting the specific page or group of pages, we want the static block to be used on the Magento 2 website.
· Finally select the static block created in the widget and then save the changes.
In conclusion, Magento 2 being an advanced version of Magento is giving out opportunities to tailor make websites as per one’s requirement. From allowing the store administrator to use static blocks in the Magento 2 store to displaying them through widgets makes it exquisite in its front end and back end functionality.