How to add the current title to the breadcrumb without preprocess function? I'm trying to get the title into my breadcrumb path without using a preprocess function. Drupal 8 Add the current title to the breadcrumb shows how to do it with preprocess function which is not what I'm trying to do.

I want my output be like this:



Here is what have been trying and have not work yet.

breadcrumb.html.twig

{#
/**
 * @file
 * Theme override for a breadcrumb trail.
 *
 * Available variables:
 * - breadcrumb: Breadcrumb trail items.
 */
#}
{% if breadcrumb %}
    &lt;nav class="breadcrumb" role="navigation" aria-labelledby="system-breadcrumb"&gt;
        &lt;h2 id="system-breadcrumb" class="visually-hidden"&gt;{{ 'Breadcrumb'|t }}&lt;/h2&gt;
        &lt;ol&gt;{{ 'You are here:'|t }}
            {% for item in breadcrumb %}
                &lt;li&gt;
                    {% if item.url %}

                        &lt;a href="{{ item.url }}"&gt;{{ item.text }}&lt;/a&gt;
                    {% else %}
                        {{ item.text }}
                    {% endif %}
                &lt;/li&gt;
                {{ '&gt;'|t }} {{title}}
            {% endfor %}
        &lt;/ol&gt;
    &lt;/nav&gt;
{% endif %}


And this is what I'm getting:



For some reason the title is not been display when I use {{ title }}.

What am I doing wrong? 

Why is my title not being displayed on my breadcrumb title?
There is also an alter hook for breadcrumbs, where you can alter them in a non-theme specific way, in case the breadcrumbs are also used somewhere else.

I've implemented this in a project:

/**
 * Implements hook_system_breadcrumb_alter().
 */
function yourmodule_system_breadcrumb_alter(array &amp;$breadcrumb, RouteMatchInterface $route_match, array $context) {
  // Append the current page title to the breadcrumb for non-admin routes.
  if ($breadcrumb &amp;&amp; !\Drupal::service('router.admin_context')-&gt;isAdminRoute()) {

    $title = \Drupal::service('title_resolver')
      -&gt;getTitle($request, $route_match-&gt;getRouteObject());
    if (!empty($title)) {
      breadcrumb-&gt;addLink(Link::createFromRoute($title, '&lt;none&gt;'));
    }
  }
}


EDIT for Drupal 8.2.x

I add a lot of error with this code, which I believe is the best approach for altering the breadcrumb has seen on Drupal API.
So here is the code for Drupal 8.2.x

/**
 * Implements hook_system_breadcrumb_alter().
 */
function YOURMODULE_system_breadcrumb_alter(\Drupal\Core\Breadcrumb\Breadcrumb &amp;$breadcrumb, \Drupal\Core\Routing\RouteMatchInterface $route_match, array $context) {
  // Append the current page title to the breadcrumb for non-admin routes.
  if ($breadcrumb &amp;&amp; !\Drupal::service('router.admin_context')-&gt;isAdminRoute()) {

    $title = \Drupal::service('title_resolver')-&gt;getTitle(\Drupal::request(), $route_match-&gt;getRouteObject());
    if (!empty($title)) {
      $breadcrumb-&gt;addLink(\Drupal\Core\Link::createFromRoute($title, '&lt;none&gt;'));
    }
  }
}