A different template based on a taxonomy term in views I'm using drupal 8.

I use the view provided by default: "taxonomy term". 

I would like to make a presentation of the page (and not only of the node) different according to the term of taxonomy. 

I tried with this code (in .theme) and template suggestion :

use Drupal\taxonomy\Entity\Term;

function THEME_NAME_theme_suggestions_page_alter(&amp;$suggestions, &amp;$vars) {
  if (\Drupal::routeMatch()-&gt;getRouteName() == 'entity.taxonomy_term.canonical' &amp;&amp; $tid = \Drupal::routeMatch()-&gt;getRawParameter('taxonomy_term')) {
    $term = Term::load($tid);
    $suggestions[] = 'page__taxonomy__' . $term-&gt;getVocabularyId();
  }
}


But it does not work because (i think) it is a view. 

I tried with the views template suggestion but it works only for the whole page and not for each taxonomy term. 

Does anyone have the solution ?
You can define each template by using template 
page--taxonomy--term--xxx.html.twig 
where xxx is your term id.

In your code, $term-&gt;getVocabularyId();
will return machine name of vocabulary, not the term id. It mean all term of this vocabulary will use this template.