I created a custom block and was able to link to it on the home page or display it there. Unfortunately I don't get the block displayed on another page I created via the backend. If I understand the whole thing correctly, do I have to change the name of the .xml created in the layout? This is how it works: enter image description here

and that's how it doesn't work: enter image description here

Do you have any idea how I can get the second case working?

1 Answer 1


First you have to Know about how layout file name should make.



cms is route name

index is controller name

index is controller action file name

Replace your required route and controller file.





namespace VendoreName\ModuleName\Controller\Index;

use Magento\Framework\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\Action\Action;

class Index extends Action implements HttpGetActionInterface, HttpPostActionInterface
     * @var PageFactory
    protected $resultPageFactory;

     * @param Context $context
     * @param PageFactory $resultPageFactory
    public function __construct(
        Context $context,
        PageFactory $resultPageFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;

     * Default customer account page
     * @return \Magento\Framework\View\Result\Page
    public function execute()
        echo "hellow";
        //return $this->resultPageFactory->create();



<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">Summary Page</argument>
        <referenceContainer name="content">




<?xml version="1.0" ?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route frontName="summary" id="summary">        
            <module name="VendoreName_ModuleName"/>

Now run Magento command

php bin/magento s:up

php bin/magento s:s:d -f

php bin/magento c:c

php bin/magento c:f

and Clear your browser cache

url like : domain/summary

I Hope This Helps You.

  • Many thanks for the answer. I have tried it and it also works with the URL: cms/index/summary But there is neither the layout nor the rest of the content of the summary page. My goal would be that it is located within the cms page "summary", i.e. callable with the following URL: domain/summary and there as a block as additional content. Could you help me with that?
    – Jackridder
    Mar 31, 2020 at 9:22
  • please check my updated answer and update me
    – Msquare
    Mar 31, 2020 at 9:36
  • Hello again, thank you for the quick answers! I tested it immediately and the message "hellow" only appears on the "domain/summary/index" page. Am I doing something wrong or what else do I have to do? I'm sorry for the many questions, but I can't get on with this x.x
    – Jackridder
    Mar 31, 2020 at 10:03
  • have you do all change of my above change ?
    – Msquare
    Mar 31, 2020 at 10:07
  • run magento command and check it
    – Msquare
    Mar 31, 2020 at 10:07

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.