Drupal 8 - How to add link & display in twig template I have file in src/Form/TestForm.php.

I would like to add link of Forgot password in buildForm function &amp; want to display in twig template file.

How to achieve this?
You should add the link in the form builder, something like the following example:.

$forgot_password_link = \Drupal\Core\Link::createFromRoute($this-&gt;t('Password link'), 'user.pass')-&gt;toRenderable();
$form['forgot_password_link'] = [
  '#markup' =&gt; render($forgot_password_link),
];