Add block class in cms page in magento 2

In Magento, often we need to add blocks in cms page, for example home page we need feature products, new products etc. So this post is about how we can add static in cms page. There is small code that we need to add in our cms page. As in example, we are assuming we have already made a module for feature products. Now we are going to show these product in some cms page.

{{block class="Infosearchshop\FeatureProducts\Block\List" template="Infosearchshop_FeatureProducts::list.phtml"}} 



As you can see in example, there are two attributes class and template. For class attribute value, we give class name "Infosearchshop\FeatureProducts\Block\List" of our feature products block. And in template attribute, we give location of template file where we have written html and php code for list of feature products. You see, there is some strange kind of value is set for template attribute. Let me explain you, The sign "::" is a separator. Magento splits this value from "::". And there are two parts, first one is module name "Infosearchshop_FeatureProducts" and second one is file name "list.phtml" which should be located view/frontend/templates/list.phtml in your module.