You are here

protected function AmpPrepareMetadataJson::prepareMainEntity in Accelerated Mobile Pages (AMP) 8

Prepare the main entity of the page.

1 call to AmpPrepareMetadataJson::prepareMainEntity()
AmpPrepareMetadataJson::prepareMetadataJson in src/Utility/AmpPrepareMetadataJson.php
Prepares a metadata array to be ready for JSON conversion.

File

src/Utility/AmpPrepareMetadataJson.php, line 160

Class

AmpPrepareMetadataJson
Class AmpPrepareMetadataJson

Namespace

Drupal\amp\Utility

Code

protected function prepareMainEntity() {
  if (!empty($this->canonicalUrl)) {
    $this->ampPreparedMetadataJson['mainEntityOfPage'] = [
      '@type' => 'WebPage',
      '@id' => $this->canonicalUrl,
    ];
  }
}