I want override the region default template. I did that with a hook theme from my module. I want override the region custom template but only for the front page. How can I do that?

1 Answer 1


You need to implement hook_theme_suggestions_HOOK_alter() in your theme. For siderbar_first region it would look like follows:

 * Implements hook_theme_suggestions_HOOK_alter().
function THEMENAME_theme_suggestions_region_alter(&$suggestions, $vars) {
  if ($vars['elements']['#region'] == 'sidebar_first' && Drupal::service('path.matcher')->isFrontPage()) {
    $suggestions[] = 'region__sidebar_first__front';

Now region--sidebar-first--front.html.twig can be used for theming sidebar on the front page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.