How to alter breadcrumbs from my controller in my module? The breadcrumb code seems to gather everything from the URL, as it should. But in my module, the other entries used in the URL path do not represent somewhere where the user can go. They instead pass information from my form to a controller object.

Is there a way to remove these entries in the breadcrumb from my modules' controller object?
To customize your Breadcrumbs you need to take full control of the Breadcrumb for that particular route with your own Breadcrumb Builder service.

To do this, you need to create an entry in your module/profile services file:

e.g., mymodule/mymodule.services.yml

services:
  mymodule.breadcrumb:
    class: Drupal\mymodule\MyModuleBreadcrumbBuilder
    tags:
      - { name: breadcrumb_builder, priority: 100 }


You then need to create your Breadcrumb Builder class

e.g. mymodule/src/MyModuleBreadcrumbBuilder.php

&lt;?php

/**
 * @file
 * Contains Drupal\mymodule\MyModuleBreadcrumbBuilder.
 */

namespace Drupal\mymodule;

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

/**
 * Class MyModuleBreadcrumbBuilder.
 *
 * @package Drupal\mymodule
 */
class MyModuleBreadcrumbBuilder implements BreadcrumbBuilderInterface {

  /**
   * {@inheritdoc}
   */
  public function applies(RouteMatchInterface $route_match) {
    $route = $route_match-&gt;getCurrentRouteMatch();

    // Add conditionals that return TRUE when the current route should have it's
    // breadcrumb handled here.
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function build(RouteMatchInterface $route_match) {
    $breadcrumb = new Breadcrumb();
    $breadcrumb-&gt;addCacheContexts(['route']);

    // Add logic here that builds up the breadcrumbs based on desired behaviour.
    $links[] = Link::createFromRoute(t('Home'), '&lt;front&gt;');

    $breadcrumb-&gt;setLinks($links);

    return $breadcrumb;
  }

}


The applies method is where you register this Breadcrumb Builder to be used for the particular route, so build a conditional there that matches your route(s) and returns TRUE.

The build method is where you build your Breadcrumb for any routes that applies returns TRUE, so if you are dealing with multiple routes you will need to build the appropriate logic here to build said Breadcrumbs.

I recommend reading through Palantir's blog post for more background and details: https://www.palantir.net/blog/d8ftw-breadcrumbs-work