How to change a views block ID attribute to use it as anchor I have a views block with id=block-views-block-services-block-1 which I used in the menu link. 

The menu link is now shown as https://example.com/gb/#block-views-block-services-block-1 

As you can see it's really not looking nice with long hyphend words. Is there any easy way to change it to something like this https://example.com/gb/#services

I read an answer for Drupal 7 where we need to edit template.php to change the ID. But in Drupal 8 it seems that template.php is replaced with twig.html. I'm not very sure as I'm new to Drupal.

Could anyone please explain few steps on how to do it?
you should place this function in your themes/YOURTHEME/YOURTHEME.theme file:

function YOURTHEME_preprocess_block(&amp;$variables) {
  dump($variables);
}


and you will see the name of your block. You have to look for block_html_id. Based on your description the value of the block_html_id will be block-views-block-services-block-1.

Then you can simply owerdefine it this way:

function YOURTHEME_preprocess_block(&amp;$variables) {
  if ($variables['block_html_id'] == "block-views-block-services-block-1") {
    $variables['block_html_id'] = "services";
  }
}


Or you can create a custom module and you can put this function there too. In that case you have to replace the YOURTHEME to the name of the custom module.