Commit 68c32f3f authored by Lee Rowlands's avatar Lee Rowlands Committed by Damien McKenna
Browse files

Issue #3039627 by larowlan, acbramley: metatag_entity_view_alter runs for...

Issue #3039627 by larowlan, acbramley: metatag_entity_view_alter runs for every paragraph, resulting in a performance hit.
parent b3c5451d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx
  \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead.
#3042590 by Berdir: Reworked NodewordsFieldInstance to make it compatible with
  core 8.7.
#3039627 by larowlan, acbramley: metatag_entity_view_alter runs for every
  paragraph, resulting in a performance hit.


Metatag 8.x-1.12, 2020-03-30
+4 −0
Original line number Diff line number Diff line
@@ -214,6 +214,10 @@ function metatag_page_attachments_alter(array &$attachments) {
 * Implements hook_entity_view_alter().
 */
function metatag_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
  if (!$entity->getEntityType()->hasLinkTemplate('canonical')) {
    return;
  }

  // If this is a 403 or 404 page then don't output these meta tags.
  // @todo Make the default meta tags load properly so this is unnecessary.
  if ($display->getOriginalId() == 'node.403.default' || $display->getOriginalId() == 'node.404.default') {