How to create a link that uses a route? I am trying to add a link to a taxonomy landing page, like this 

$breadcrumbs-&gt;addLink(Link::createFromRoute($term_name,"/taxonomy/term/$tid"));


but I get the following error : Symfony\Component\Routing\Exception\RouteNotFoundException: Route "/taxonomy/term/2041" does not exist. in Drupal\Core\Routing\RouteProvider-&gt;getRouteByName() (line 187 of C:\drupaldevsites\pup-dev\docroot\core\lib\Drupal\Core\Routing\RouteProvider.php).
The argument has to be a route name.

Try:

$breadcrumbs-&gt;addLink(Link::createFromRoute($term_name, "entity.taxonomy_term.canonical", ["taxonomy_term" =&gt; $tid]));


See the docs for this method.