I've created a breadcumb using this and I've created one. But I would like to create breadcrumb for each page. I've 3 forms, above the form I need to set the progress of the form in the form of breadcrumb,

Drupal 7

$breadcrumb[] = l('hi', '/hi');

In drupal 8 I've tried to use

$b = new Breadcrumb();
$breadcrumb[] = Link::createFromRoute(t('Home'), '<front>');
return $b->setLinks($new_breadcrumbs);

But this is not working... how we can show that and where am I doing wrong?

1 Answer 1


There is a block in drupal 8 for displaying breadcrumb on your pages. First set visibility of that block on the pages you want to show breadcrumbs.

Then in template_preprocess_breadcrumb in your theme's .theme file you can change the breadcrumbs variables.

For additional functionality you can create breadcrumb.html.twig file in templates folder of your theme.

  • Is this the best way to create a simple static breadcrumb? Feb 19, 2016 at 11:02
  • For creating static breadcrumb set your breadcrumb variable in template_preprocess_breadcrumb. Feb 19, 2016 at 11:07
  • I want it above a form Feb 19, 2016 at 11:08

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.