Generating URL to taxonomy term (tag) I am trying to insert tag url and page title in breadcrumb path. With page title everything is Ok, however I can't find any info how to get tags, or how to generate url for them. I think I am getting tag how I am supposed to, but this returns object of Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem without id (?). So How could I gennerate Url from this object?

function theme_preprocess_breadcrumb(&amp;$vars) {
  $node = \Drupal::request()-&gt;attributes-&gt;get('node');
  $title = $node-&gt;getTitle();

  $tag = $node-&gt;field_tags-&gt;first();

  $vars['breadcrumb'][] = [
      'text' =&gt; $title
  ];
}
Yes, I agree with Ivan.

Here is a blog post that recommends creating a new breadcrumb builder service. https://www.palantir.net/blog/d8ftw-breadcrumbs-work

The key pieces are extending BreadcrumbBuilderBase and defining the service in a yml file. 

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


While data can be manipulated in the preprocess layer it should be used for visual changes rather than behavioral changes.

Now to answer your more direct question of how to actually generate the links. I think what you want is something like 

$node-&gt;field_tags-&gt;referencedEntities()[0]-&gt;id();


I recommend looking at BookBreadcrumbBuilder both for the Breadcrumb specific parts and the link construction. There you'll see links constructed like this:

$links[] = Link::createFromRoute($parent_book-&gt;label(), 'entity.node.canonical', array('node' =&gt; $parent_book-&gt;id()));