Problem with HOOK_preprocess_breadcrump (Caching?) I run in a strange issue with breadcrumb modifying. In my template, I created a hook to show the current page in the breadcrumbs (for testing):

function business_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()
                   );
     }

}


The code above works after clearing the cache and loading the first node page. However, as soon as I load any other node page, it's always showing the title of the first loaded node (like it is cached). Even when I echo the Node id, I always see the same ID from the first node. How can I fix this?
I even tried to create a custom module which overrides the breadcumb generation - same result here.

Drupal 8.1.1.
Change the cache context from 'url.path' to 'url'

function xxx_preprocess_breadcrumb(&amp;$variables) {
    ...
    $variables['breadcrumb'] = array(
      array(
        'text' =&gt; 'some text',
        'url' =&gt; "/someurl"
      )
    );       
    ...
    $variables['#cache']['contexts'][] = 'url';         
}


I ran into the same problem with Drupal 8.2.4