How do I theme a link?
I think the problem with your Drupal 8 code is that '#url' needs a URL object.

External URL

'#url' =&gt; Url::fromUri('https://www.drupal.org'),


Internal URL from a route

'#url' =&gt; Url::fromRoute('entity.node.canonical', ['node' =&gt; 1]),


In Drupal 8 you are not supposed to render yourself. When porting code from Drupal 7, remove all rendering and return only render arrays.