Show pages with a specific template when user is logged-in I would like to know if there is a way to show an existing node with a custom template if user is logged-in or has a specific role. 

I have tried with a custom module route.

custom_module.presentation:
  path: '/node/1'
  defaults:
    _controller: '\Drupal\custom_module\Controller\myController::custom_presentation'
    _title: 'presentation'
  requirements:
    _permission: 'access content'
    _user_is_logged_in: 'TRUE'


In the page controller, I used the following code.

public function custom_presentation() {
        $myVariables = array();

        $build = [
            'description' =&gt; [
                '#theme' =&gt; 'my_custom_template',
                '#scriptVars' =&gt; $myVariables
            ]
        ];
        return $build;
    }


It doesn't work, though. What is the correct way of doing it?
The most basic way of providing a custom template for a node that meets certain criteria, is using theme hook suggestions.

You can for example add a custom theme suggestion by implementing hook_theme_suggestions_HOOK_alter() in a custom module. There you can check whether your criteria are met and add a custom theme suggestion, if they are:

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function MYMODULE_theme_suggestions_node_alter(array &amp;$suggestions, array $variables) {

  if (
    // Do your checks here, e.g authenticated user?
    \Drupal::currentUser()-&gt;isAuthenticated()
  ) {
    // Add your custom template here. The following
    // example would apply to 'my-node.html.twig'.
    $suggestions[] = 'my_node';
  }

}