How do I modify the breadcrumb? I want to modify my bread crumb ( remove one link from bread crumb and add one link to bread drumb).  

I tried,

/**
 * Implements hook_system_breadcrumb_alter().
 */
function modulename_system_breadcrumb_alter(\Drupal\Core\Breadcrumb\Breadcrumb &amp;$breadcrumb, \Drupal\Core\Routing\RouteMatchInterface $route_match, array $context) {
// to get current path and alias 
  $current_path = \Drupal::service('path.current')-&gt;getPath();
  $result = \Drupal::service('path.alias_manager')-&gt;getAliasByPath($current_path);

// get current route name 
  $route_name = \Drupal::service('current_route_match')-&gt;getRouteName();
// check route is an quickinfo content create in group 
  if ($breadcrumb &amp;&amp; $route_name == 'entity.group_content.group_node__quickinfo.create_form') {
// get bread crumb links
    $breadcrumb_links = $breadcrumb-&gt;getLinks();
// fetch titile of the current path    
    $title = \Drupal::service('title_resolver')-&gt;getTitle(\Drupal::request(), $route_match-&gt;getRouteObject());
    if (!empty($title)) {
// change third link of a breadcrumb 
     $breadcrumb_links['2'] = Link::createFromRoute(t('RZ-schnellinfo'), '&lt;none&gt;');
    }
//    set links again
   $breadcrumb-&gt;setLinks($breadcrumb_links);
  }
}


SetLinks() ==> work when only bread crumb links doesn't exist, i.e.. we can create new links by using addLinks(). Since we need to remove a link we can use this function .  

Then I followed https://www.drupal.org/node/2026025  but I am getting below error. 


  exception
  'Symfony\Component\DependencyInjection\Exception\LogicException' with
  message 'Service                                    [error]
  'xxxxx.breadcrumb_xxxx_create' for consumer 'breadcrumb' does not
  implement Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface.' in
As comment said above, you have to implement Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface. Here is a working snippet that I use to implement those Breadcrumbs :

It appends a custom routename to all 'Nodes' pages :


&lt;?php

namespace Drupal\Your_Module_Namespace\Breadcrumb;

use Drupal;
use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Link;
use Drupal\Core\Routing\RouteMatchInterface;

class Your_Module_NamespaceBreadCrumbBuilder implements BreadcrumbBuilderInterface {

  /**
   * {@inheritdoc}
   */
  public function applies(RouteMatchInterface $attributes) {
    $parameters = $attributes-&gt;getParameters()-&gt;all();
    // I need my breadcrumbs for a few node types ONLY,
    // so it should be applied on node page ONLY.
    if (isset($parameters['node']) &amp;&amp; !empty($parameters['node'])) {
      return TRUE;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function build(RouteMatchInterface $route_match) {
    $breadcrumb = new Breadcrumb();
    $breadcrumb-&gt;addLink(Link::createFromRoute('Home', '&lt;front&gt;'));

    $node = Drupal::routeMatch()-&gt;getParameter('node');
    $node_type = $node-&gt;bundle();

    // Put the needed logic here

    // addLink example
    $breadcrumb-&gt;addLink(Link::createFromRoute('My Page Name', 'drupal_internal.routename'));
    $breadcrumb-&gt;addCacheContexts(['route']);

    return $breadcrumb;
  }
}