Skip to content

Commit

Permalink
Check we have schemas to output
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Le Poidevin committed Aug 3, 2023
1 parent ead2a0c commit 7fbffb4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Traits/SchemaOrg.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ public function schemaOrgScript(): string
{
$schemaJson = '';

foreach ($this->meta()['schema_org'] as $schema) {
$schemaJson .= $schema->toScript();
}
if (array_key_exists('schema_org', $this->meta())) {
foreach ($this->meta()['schema_org'] as $schema) {
$schemaJson .= $schema->toScript();
}
}

return $schemaJson;

return $schemaJson;
}

/**
Expand Down

0 comments on commit 7fbffb4

Please sign in to comment.