How do I pass variables into Twig template? In my preprocess function I have variables with the route name and route parameters:

function my_theme_preprocess_node(&amp;$variables){
  $variables['route_name'] = $route_name;
  $variables['route_parameters'] = $route_parameters;
}


How do I pass them to the following link function in my page.html.twig file:

{ &lt;a href="{{ path('$route_name', {'node': $route_parameters}) }}"&gt;Link to the object with $route_name and $route_parameters&lt;/a&gt; }


Is it at all possible?
The '$' isn't used in twig to designate a variable. This code should work:

&lt;a href="{{ path(route_name, {'node': route_parameters}) }}"&gt;
   Link to the object with {{ route_name }} and {{ route_parameters }}
&lt;/a&gt;