You are here

function hook_metatags_alter in Metatag 8

Alter the meta tags for pages that are not of content entities.

Parameters

array $metatags: The special meta tags to be added to the page.

array $context: The context for the current meta tags being generated. Will contain the following: 'entity' - The entity being processed; passed by reference.

2 functions implement hook_metatags_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

metatag_page_manager_metatags_alter in metatag_page_manager/metatag_page_manager.module
Implements hook_metatag_alter().
metatag_views_metatags_alter in metatag_views/metatag_views.module
Implements hook_metatags_alter().
2 invocations of hook_metatags_alter()
metatag_get_tags_from_route in ./metatag.module
Load the meta tags by processing the route parameters.
metatag_tokens in ./metatag.tokens.inc
Implements hook_tokens().

File

./metatag.api.php, line 38
Document all supported APIs.

Code

function hook_metatags_alter(array &$metatags, array &$context) {

  // Exclude meta tags on frontpage.
  if (\Drupal::service('path.matcher')
    ->isFrontPage()) {
    $metatags = NULL;
  }
}