Link's href value gets lost I am trying to make a link on node by returning this array(The array is being formed in the function by the name buildLinks() ):

     $links[$key] = array(

    'title' =&gt; $definition['title'],

    'href' =&gt; $this-&gt;urlGenerator-&gt;generateFromRoute('module.show_format.' . $entity-&gt;getEntityTypeId(), array('module_format' =&gt; $key, 'entity' =&gt; $entity-&gt;id())),
  );


but on the page the link title is appearing but the link's href value gets lost(I mean title is appearing but it is not appearing as link).What am I doing wrong?

Update: The above array is being returned over here:

    return array(
    '#theme' =&gt; 'links__entity__module',
    '#links' =&gt; $this-&gt;linkBuilder-&gt;buildLinks($this-&gt;request-&gt;attributes-&gt;get($entity_type)),
  );


So is there is a possiblity that I am doing something wrong over here?
Looks like the documentation around that theme function is out of date. Please open a bug report for that.

Have a look at template_preprocess_links, it is using url, not href. Also not that url is a Drupal\Core\Url object, not a path, so your code should look like this:

$links[$key] = array(
  'title' =&gt; $definition['title'],
  'url' =&gt; Url::fromRoute('module.show_format.' . $entity-&gt;getEntityTypeId(), array('module_format' =&gt; $key, 'entity' =&gt; $entity-&gt;id())),
);