I'm using the "basic" skin

my type of content is called "apartments"

when a file is added page--apartamenty.html.twig it does not work this way.

I have drupal 8.7.3

I use this method and it does not work what I'm doing wrong?

https://befused.com/drupal/page-template-content-type

Comments

ganesh9930’s picture

Hi cytryn3,

I'm using drupal version-8.7.5 and basic theme - 8.x-2.0.

function basic_theme_suggestions_page_alter(array &$suggestions, array $variables) {

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

Write the above code into basic.theme file and clear cache.

Please check it.

richard.barth’s picture

Hi ganesh9930,

Will this solution work for drupal 9.1.3?