How can I render an URL path from a custom route? In my module.routing.yml (and using D8), I have a module_new route associated with the /module/name path.

I want to render this path in my module. How can I show http://example.org/module/name on a page?
Twig

You can use the route name in the twig function url():

&lt;a href="{{ url('module_new') }}"&gt;{{ 'View my module content'|t }}&lt;/a&gt;


Controller

Or you can do the same in a controller:

use Drupal\Core\Url;

  $url = Url::fromRoute('module_new', [], ['absolute' =&gt; TRUE]);

  // get the path as string (not recommended)
  $path = $url-&gt;toString;

  // better put the complete url object in a render array and let the template render it
  $build['link'] = [
   '#title' =&gt; $this-&gt;t('My module content'),
   '#type' =&gt; 'link',
   '#url' =&gt; $url,
  ];

  return $build;