I have created a page using the CMS (via Admin Portal) and now I want to add a custom block (programmed) to the page. You can see the created page here: enter image description here

My structure is the following:

enter image description here

but unfortunately I do not get the created CMS page with the block connected. I thought that maybe the Router ID has to be set to cms. But I don't know exactly how to adjust the files accordingly. Do you have any ideas?

1 Answer 1


Using module you can add your block like this.

Add in your layout file


<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="content">
             <block class="VenAbf\ModAbf\Block\Index" name="call_block_name" template="VenAbf_ModAbf::testinase.phtml" />

Using admin panel go to you cms page and click on edit and add this line and click on save

{{block class="VenAbf\ModAbf\Block\Index" template="VenAbf_ModAbf::testinase.phtml"}}

Please run magento command after adding above code.

php bin/magento s:up
php bin/magento s:s:d -f
php bin/magento c:f

I Hope This Helps You.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.