diff -u b/core/includes/theme.inc b/core/includes/theme.inc --- b/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -978,7 +978,7 @@ $variables['links'] = array(); foreach ($links as $key => $link) { - $item = array('link_key' => $key); + $item = array(); $link += array( 'ajax' => NULL, 'url' => NULL, @@ -1040,7 +1040,7 @@ $item['attributes'] = new Attribute($li_attributes); // Add the item to the list of links. - $variables['links'][] = $item; + $variables['links'][$key] = $item; } } } diff -u b/core/modules/system/templates/links.html.twig b/core/modules/system/templates/links.html.twig --- b/core/modules/system/templates/links.html.twig +++ b/core/modules/system/templates/links.html.twig @@ -45,8 +45,8 @@ {%- endif -%} {%- endif -%} - {%- for item in links -%} - + {%- for key, item in links -%} + {%- if item.link -%} {{ item.link }} {%- elseif item.text_attributes -%}