diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index eba2828..6d9e128 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -138,8 +138,9 @@ function taxonomy_term_uri($term) { * Implements hook_page_build(). */ function taxonomy_page_build(&$page) { - if (\Drupal::request()->attributes->get(RouteObjectInterface::ROUTE_NAME) == 'taxonomy.term_page') { - $term = \Drupal::request()->attributes->get('taxonomy_term'); + $request = \Drupal::request(); + if ($request->attributes->get(RouteObjectInterface::ROUTE_NAME) == 'taxonomy.term_page') { + $term = $request->attributes->get('taxonomy_term'); foreach ($term->uriRelationships() as $rel) { // Set the term path as the canonical URL to prevent duplicate content. $page['#attached']['drupal_add_html_head_link'][] = array(