You should create a custom module (use core >= 8.3). Use this code as a base to start:
custom_breadcrumb.info.yml
name: 'Custom breadcrumbs'
description: 'Custom breadcrumbs implementation'
package: 'Custom'
# core: 8.x
type: module
version: '8.x-1.0'
core: '8.x'
project: 'custom_breadcrumb'
datestamp: 1443649740
custom_breadcrumb.services.yml
services:
custom_breadcrumb.breadcrumb_views:
class: Drupal\custom_breadcrumb\Breadcrumb\ViewsBreadcrumbBuilder
tags:
- { name: breadcrumb_builder, priority: 1 }
src/Breadcrumb/ViewsBreadcrumbBuilder.php
<?php
namespace Drupal\custom_breadcrumb\Breadcrumb;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Routing\LinkGeneratorTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Link;
class ViewsBreadcrumbBuilder implements BreadcrumbBuilderInterface {
use LinkGeneratorTrait;
use StringTranslationTrait;
/**
* @inheritdoc
*/
public function applies(RouteMatchInterface $route_match) {
// This breadcrumb apply only for some views.
$parameters = $route_match->getParameters()->all();
if (isset($parameters['view_id'])) {
$views_id = array(
'VIEW_MACHINE_NAME_1',
'VIEW_MACHINE_NAME_2',
);
if (in_array($parameters['view_id'], $views_id)) {
return TRUE;
}
return FALSE;
}
}
/**
* @inheritdoc
*/
public function build(RouteMatchInterface $route_match) {
// Breadcrumbs set up (cache settings are so important!).
$breadcrumb = new \Drupal\Core\Breadcrumb\Breadcrumb();
$breadcrumb->addCacheContexts(["url"]);
$breadcrumb->addCacheTags(["view_id:{$parameters['view_id']}"]);
$parameters = $route_match->getParameters()->all();
if (isset($parameters['view_id'])) {
if ($parameters['view_id'] == 'VIEW_MACHINE_NAME_1') {
$breadcrumb->addLink(Link::createFromRoute(t('VIEWS NAME 1'), '<none>'));
}
else if ($parameters['view_id'] == 'VIEW_MACHINE_NAME_2') {
$breadcrumb->addLink(Link::createFromRoute(t('VIEWS NAME 2'), '<none>'));
}
}
// Reverse order for this to work!!!.
$breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
return $breadcrumb;
}
}
Remember to replace VIEW_MACHINE_NAME_1 and VIEW_MACHINE_NAME_2 with the machine name of your views. Also replace VIEWS NAME 1 and VIEWS NAME 2 with the breadcrumb title you want for each view.