Add a custom page template based on content types Drupal ?

  Drupal 7:
  function THEMENAME_preprocess_page(&$variables) {
  if(isset($variables['node']->type)) {
     $variables['theme_hook_suggestions'][]  = 'page__'.$variables['node']->type;
  }
 }

  Drupal 8:
  hook_theme_suggestions_HOOK_alter()
  Alters named suggestions for all theme hooks.

  To add a template file suggestion for the page hook, you would implement hook_theme_suggestions_page_alter().

  In the .theme file we have to add the following hook function.

  <?php
  /**
   * Implements hook_theme_suggestions_HOOK_alter().
   */
  function THEMENAME_theme_suggestions_page_alter(array &$suggestions, array $variables) {

    if ($node = \Drupal::routeMatch()->getParameter('node')) {
      $content_type = $node->bundle();
      $suggestions[] = 'page__'.$content_type;
    }
  }
  ?>

Tags

Instagram Without API

Could not reach Instagram server