How to make page.html.twig based on Vocabulary? I want to make different page.html.twig according to different Vocabulary.
 I found this code:

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();
  }
}


in How do I theme a taxonomy term page?.
Code does not work:


  Fatal error: Class 'Term' not found in...


Excuse me, what is the reason, I really need to customize the page.html.twig according to the vocabulary, you can help me？
Because you have not included the PHP code that contains the Class.

See Namespacing in PHP.

According to term.php the name space is Drupal\taxonomy\Entity. 

So you need to add use [name space]\[class name]; at the top. 

Therefore, it would be use Drupal\taxonomy\Entity\Term;. 

Example:

&lt;?php

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();
  }
}