1
votes

I have created a custom theme and added regions. I want to create and assign a custom block to the regions. How can I do it?

As an experimental purpose I have created a folder named 'blocks' in path /themes/custom_theme/templates and named the block 'block--regionname.twig.html'. But no hope. Please advice. I think i'm on a wrong track.

1

1 Answers

1
votes

If you make your "custom block" in template in your theme, that not will be available in the Block layout page in your Drupal site and you can't place it to a region.

You can create custom blocks in Structure -> Block Layout -> Add custom block. Or you can create it from custom module. These will be available in the Block Layout page, and you can place into a region. You can define twig template for your block in your custom module, and you can write HTML into it.

https://www.drupal.org/docs/8/creating-custom-modules/create-a-custom-block