diff --git a/src/Render/AmpResponseAttachmentsProcessor.php b/src/Render/AmpResponseAttachmentsProcessor.php index dd3b622..9f2d79f 100644 --- a/src/Render/AmpResponseAttachmentsProcessor.php +++ b/src/Render/AmpResponseAttachmentsProcessor.php @@ -232,7 +232,7 @@ class AmpResponseAttachmentsProcessor implements AmpAttachmentsResponseProcessor $schema_metatags = []; foreach ($amp_html_head as $item) { list($data, $key) = $item; - if ($data['#attributes']['schema_metatag']) { + if (array_key_exists('schema_metatag', $data['#attributes'])) { // Schema metatag: First time through, collect and nest by group. $group = $data['#attributes']['group']; // Nest items by the group they are in. @@ -244,7 +244,7 @@ class AmpResponseAttachmentsProcessor implements AmpAttachmentsResponseProcessor continue; } - if ($data['#attributes']['rel'] == 'canonical') { + if (array_key_exists('rel', $data['#attributes']) && $data['#attributes']['rel'] == 'canonical') { continue; } @@ -277,7 +277,6 @@ class AmpResponseAttachmentsProcessor implements AmpAttachmentsResponseProcessor '#value' => $jsonld, '#attributes' => ['type' => 'application/ld+json'], ], - 'schema_metatag', ]; } }