How do I add custom template files? Currently, I am using the following code.

/**
 * Implements hook_theme_registry_alter().
 */
function MY_MODULE_theme_registry_alter(&amp;$theme_registry) {
  // Defined path to current module.
  $is_admin = Drupal::service('router.admin_context')-&gt;isAdminRoute();
  $node = \Drupal::routeMatch()-&gt;getParameter('node');
  if (isset($node)) {
    if ($node-&gt;getType() == 'MY_CONTENT_TYPE' &amp;&amp; $is_admin == 0) {
      $module_path = drupal_get_path('module', 'reveal_js');
       $theme_registry['html']['path'] = $module_path . '/templates';
       $theme_registry['page']['path'] = $module_path . '/templates';
    }
  }
}


This works, but when going to another page, I have to rebuild cache in order for it to re-evaluate whether the node is 'MY_CONTENT_TYPE' or a different type.
It looks like hook_theme_registry_alter() is only executed when the theme cache is rebuilt. This means that what you need to do is use one of the theme_suggestion_alter hooks, such as hook_theme_suggestions_alter() or hook_theme_suggestions_node_alter(). These get run for each page before it is cached, I believe, instead of only once on cache rebuild.

So, what you want to do in your module is create a theme implementation using hook_theme(). That would look something like this:

function MYMODULE_theme($existing, $type, $theme, $path) {
  return array(
    'my_theme_implementation' =&gt; array(
      'path' =&gt; drupal_get_path('module', 'reveal_js') . '/templates',
      'template' =&gt; 'my_theme_implementation',
    ),
  );
}


And then your hook_theme_suggestions_node_alter() would be something like

function MYMODULE_theme_suggestions_node_alter(&amp;$suggestions, $variables) {
  $is_admin = Drupal::service('router.admin_context')-&gt;isAdminRoute();
  $node = $variables['elements']['#node']
  if ($node-&gt;getType() == 'MY_CONTENT_TYPE' &amp;&amp; $is_admin == 0) {
    $suggestions[] = 'my_theme_implementation';
  }
}


Does that all make sense?