I have rendered the breadcrumb in page.html.twig

{# Breadcrumbs #}
    {% if breadcrumb %}
      {% block breadcrumb %}
        {{ breadcrumb }}
      {% endblock %}
    {% endif %}

and default breadcrumb block is available in the block layout. And then I have assigned in the block in Highlighted region.

When I debugging the breadcrumb, its not working properly.

Please help me , how to sort out this issue?


The twig code doesn't work and you don't need it for the breadcrumb block to be available in the block layout. It's the other way, first you assign the breadcrumb block in for example the Highlighted region. Then you print the region with the breadcrumbs in page.html.twig:

{{ page.highlighted }}

In D8 it's not possible to access the breadcrumbs in the page template directly. You have to use a Drupal block. See https://www.drupal.org/node/2410773.

BTW Twig Blocks are not connected to Drupal blocks. They are used to extend templates:

Blocks are used for inheritance and act as placeholders and replacements at the same time. They are documented in detail in the documentation for the extends tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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