Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By cytryn3 on
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?
Comments
create page templates for content type in drupal 8
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.
Hi ganesh9930,
Hi ganesh9930,
Will this solution work for drupal 9.1.3?