Skip to content

Commit 513bc94

Browse files
Fix JSON-LD entity type comparison to be case-insensitive (#499)
Co-authored-by: Duncan McClean <duncan@duncanmcclean.com>
1 parent b045a7a commit 513bc94

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Cascade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ protected function jsonLd()
585585
$jsonLdOrganizationLogo = $this->data->get('json_ld_organization_logo');
586586
$jsonLdPersonName = (string) $this->data->get('json_ld_person_name');
587587

588-
if ($jsonLdEntity === 'Organization' && $jsonLdOrganizationName) {
588+
if ($jsonLdEntity === 'organization' && $jsonLdOrganizationName) {
589589
if ($jsonLdOrganizationLogo && ! $jsonLdOrganizationLogo instanceof Value) {
590590
$jsonLdOrganizationLogo = Asset::find($jsonLdOrganizationLogo);
591591
}
@@ -602,7 +602,7 @@ protected function jsonLd()
602602
]), JSON_UNESCAPED_SLASHES));
603603
}
604604

605-
if ($jsonLdEntity === 'Person' && $jsonLdPersonName) {
605+
if ($jsonLdEntity === 'person' && $jsonLdPersonName) {
606606
$snippets->push(json_encode([
607607
'@context' => 'https://schema.org',
608608
'@type' => 'Person',

tests/CascadeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ public function it_generates_json_ld_data()
379379
$siteDefaults = SiteDefaults::in('default')->set([
380380
'site_name' => 'Cool Writings',
381381
'description' => 'Bob sled team',
382-
'json_ld_entity' => 'Person',
382+
'json_ld_entity' => 'person',
383383
'json_ld_person_name' => 'Derice Bannock',
384384
]);
385385

@@ -403,7 +403,7 @@ public function it_generates_json_ld_breadcrumbs()
403403
$siteDefaults = SiteDefaults::in('default')->set([
404404
'site_name' => 'Cool Writings',
405405
'description' => 'Bob sled team',
406-
'json_ld_entity' => 'Person',
406+
'json_ld_entity' => 'person',
407407
'json_ld_person_name' => 'Derice Bannock',
408408
'json_ld_breadcrumbs' => true,
409409
]);

0 commit comments

Comments
 (0)