I have a site where the breadcrumb is in different locations depending on what node type or page is being viewed.
In some places, it is interspersed with node content, so the only solution was for my colleague to inject it into the page as a variable, like so (from .theme
):
$ block = Block::load('breadcrumbs'); $ variables['content']['breadcrumbs'] = \Drupal::entityTypeManager()->getViewBuilder('block')->view($ block);
I’ve noticed that when I deploy code, the breadcrumbs disappear. I then have to clear the cache, clear Varnish, and clear the cache again and finally hard refresh in my browser to see them again.
Is this related to how breadcrumbs are being injected into the page and if so, is there a better way to do it?