Incorrect Drupal 8 Breadcrumbs I'm trying to add the page title to the breadcrumbs for each page, unfortunately my breadcrumbs are not updating with current page title. All sibling pages in the menu show the same breadcrumbs.

For example, all these pages will show the same breadcrumbs:

Home &gt; About Us &gt; Our Team
Home &gt; About Us &gt; Our Mission
Home &gt; About Us &gt; Another Page


Whatever page you visit first, you will get the breadcrumbs for that page on all of the above pages. So if you visit the "Our Team" page first, you will get the "Our Team" breadcrumbs on the "Our Mission" and "Another Page" pages as well. The same happens for 2nd level pages.

So if you visit

Home &gt; About Us


You will get the About Us breadcrumbs on

Home &gt; Services


However, you will not get the Home > About Us> Our Team breadcrumbs on

Home &gt; Services &gt; Service A


I have this code in my .theme file:

function themename_preprocess_breadcrumb(&amp;$variables){
   if(($node = \Drupal::routeMatch()-&gt;getParameter('node')) &amp;&amp; $variables['breadcrumb']){
       $variables['breadcrumb'][] = array(
                 'text' =&gt; $node-&gt;getTitle(),
                     'url' =&gt; $node-&gt;URL()
                   );
   }
}


And this for my breadcrumbs template:

{% 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;
    {% 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;
    {% endfor %}
    &lt;/ol&gt;
  &lt;/nav&gt;
{% endif %}


I'm guessing it's some sort of caching issue, as it seems to happen per-session (different users will get stuck with different breadcrumbs depending on which pages they visit first).

Anyone know why this may be happening?
I ran into the same issue 

https://www.drupal.org/node/2723061

function my_theme_preprocess_breadcrumb(&amp;$variables) {
  if (($node = \Drupal::routeMatch()-&gt;getParameter('node')) &amp;&amp; $variables['breadcrumb']) {
    /** @var \Drupal\node\NodeInterface $node */
    $variables['breadcrumb'][] = [
      'text' =&gt; $node-&gt;getTitle(),
      'url' =&gt; $node-&gt;toUrl(),
    ];
    $variables['#cache']['contexts'][] = 'url';
    $variables['#cache']['contexts'][] = 'session';
    $variables['#cache']['contexts'][] = 'user';      
  }
}


So:

$variables['#cache']['contexts'][] = 'session';
$variables['#cache']['contexts'][] = 'user';
$variables['#cache']['contexts'][] = 'url';   


did the trick for me.