Twig template for two different instances of the system branding block On the block layout page, I added the "Site Branding" block twice, once for normal use (all nodes except content type landing page) and once for landing page use (all nodes of content type landing page).

I themed the block using the twig template block--system-branding-block.html.twig, but this modifies both blocks.

Is there a way to get more specific and create a twig template for each block, or should I re-create the landing page block some other way so that I can use a different template?

EDIT: My goal is to actually change the HTML of the block, so I can't use a pure CSS approach.
There's a few things you can do. Here's three.


Consider using a pure CSS approach. If you look at the body element for your page there may well be different classes you can use to make different selectors for styling the block. Modern CSS, particularly with the availability of :before and :after pseudo selectors, is incredibly powerful and you very often don't need custom HTML to adjust styling for different cases.
You can also implement hook_theme_suggestions_alter in your theme (in the file mytheme.theme) to supply alternative template suggestions based on the current path, for example.


Following this example, your code might look like:

function THEME_NAME_theme_suggestions_block_alter(array &amp;$suggestions, array $variables) {
  $current_path = \Drupal::service('path.current')-&gt;getPath();
  $result = \Drupal::service('path.alias_manager')-&gt;getAliasByPath($current_path);

  $path_alias = trim($result, '/');
  $path_alias = str_replace('/', '-', $path_alias);
  $path_alias = str_replace('-', '_', $path_alias);
  $id = $variables['id'];

  $suggestions[] = 'block__path_alias__'.$path_alias;
  $suggestions[] = 'block__' . $id . '__path_alias__'.$path_alias;
}



Another option would be to create a second variant of the site branding block then use the option in Drupal's block system which lets you turn blocks on or off by content type.