Skip to content

Commit

Permalink
fix: fix jsonLdSchema (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Feb 25, 2024
1 parent f41bf8a commit b4703d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/Http/ViewModels/Names/NameViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ public static function jsonLdSchema(Name $name): array
{
return [
'headline' => 'Tout savoir sur le prénom ' . StringHelper::formatNameFromDB($name->name),
'image' => env('APP_URL') . '/img/facebook.png',
'date' => Carbon::now()->format('Y-m-d'),
'image' => asset('/img/facebook.png'),
'updated_at' => $name->updated_at->format('Y-m-d'),
'created_at' => $name->updated_at->format('Y-m-d'),
'url' => route('name.show', [
'id' => $name->id,
'name' => StringHelper::sanitizeNameForURL($name->name),
Expand Down
10 changes: 5 additions & 5 deletions resources/views/names/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
},
"author": {
"@type": "Organization",
"name": "choisisunprenom.com"
"name": "touslesprenoms.org"
},
"publisher": {
"@type": "Organization",
"name": "choisisunprenom.com",
"name": "touslesprenoms.org",
"logo": {
"@type": "ImageObject",
"url": "{{ $jsonLdSchema['image'] }}}"
"url": "{{ $jsonLdSchema['image'] }}"
}
},
"headline": "{{ $jsonLdSchema['headline'] }}",
"image": {{ $jsonLdSchema['image'] }},
"datePublished": "{{ $jsonLdSchema['date'] }}",
"dateModified": "{{ $jsonLdSchema['date'] }}",
"datePublished": "{{ $jsonLdSchema['created_at'] }}",
"dateModified": "{{ $jsonLdSchema['updated_at'] }}",
}
</script>
</x-slot>
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/ViewModels/Names/NameViewModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ public function it_gets_the_data_to_feed_the_json_schema_ld_file(): void
[
'headline' => 'Tout savoir sur le prénom Héloïse',
'image' => env('APP_URL') . '/img/facebook.png',
'date' => '2018-01-01',
'created_at' => '2018-01-01',
'updated_at' => '2018-01-01',
'url' => env('APP_URL') . '/prenoms/' . $name->id . '/heloise',
],
$array
Expand Down

0 comments on commit b4703d6

Please sign in to comment.