Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll
14/04/2025, by Ivan

Return to the root folder of your module where the .info.yml file is located, add a new file named hello_world.routing.yml, and add the following content to it:

hello_world.content:
  path: '/hello'
  defaults:
    _controller: '\Drupal\hello_world\Controller\HelloController::content'
    _title: 'Hello World'
  requirements:
    _permission: 'access content'

Note that the space you reserve in the routing table for your module, "hello_world" in hello_world.content on the first line, does not necessarily have to be the machine name you chose for your module. However, to maintain consistency between routing and menu files, this is best practice. The full entry name, hello_world.content, will be used in the next section when adding a menu link to associate that link with this routing table entry.

If your module is already enabled, you need to clear your site's cache through the user interface at admin/config/development/performance or using Drush (drush cache-rebuild or drush cr). If not, go ahead and enable it.

Now go to the front page of your site, and then add /hello to the end of your site's URL in the address bar. You should see a page with a “Hello, World!” message on it.

Note that the module.routing.yml file requires correct indentation; otherwise, you may encounter an issue after clearing the Drupal cache.

Learn more about routing in Drupal 8.

Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.