@@ -180,6 +180,7 @@ public function set_metadata($data = [])
180
180
'@context ' => 'https://schema.org ' ,
181
181
'@type ' => 'DiscussionForumPosting ' ,
182
182
'url ' => $ default ['url ' ],
183
+ 'mainEntityOfPage ' => $ default ['url ' ],
183
184
'headline ' => '' ,
184
185
'description ' => $ default ['description ' ],
185
186
'text ' => $ default ['description ' ],
@@ -201,6 +202,17 @@ public function set_metadata($data = [])
201
202
'width ' => (int ) $ this ->config ['seo_metadata_json_ld_logo_width ' ],
202
203
'height ' => (int ) $ this ->config ['seo_metadata_json_ld_logo_height ' ]
203
204
]
205
+ ],
206
+ 'comment ' => [
207
+ [
208
+ '@type ' => 'Comment ' ,
209
+ 'text ' => '' ,
210
+ 'author ' => [
211
+ '@type ' => 'Person ' ,
212
+ 'name ' => '' ,
213
+ 'url ' => ''
214
+ ]
215
+ ]
204
216
]
205
217
]
206
218
];
@@ -370,6 +382,15 @@ public function metadata_template_vars()
370
382
unset($ data ['json_ld ' ]['publisher ' ]['logo ' ]);
371
383
}
372
384
385
+ // JSON-LD comment
386
+ foreach ($ data ['json_ld ' ]['comment ' ] as $ key => $ value )
387
+ {
388
+ if (empty ($ value ['text ' ]))
389
+ {
390
+ unset($ data ['json_ld ' ]['comment ' ][$ key ]);
391
+ }
392
+ }
393
+
373
394
// Ignore disabled options
374
395
foreach ($ data as $ key => $ value )
375
396
{
@@ -387,17 +408,19 @@ public function metadata_template_vars()
387
408
// Assign data to template
388
409
foreach ($ data as $ key => $ value )
389
410
{
411
+ $ type = strtoupper ($ key );
412
+
390
413
$ this ->template ->assign_block_vars (
391
414
'SEO_METADATA ' ,
392
415
[
393
- 'NAME ' => strtoupper ( $ key ) ,
416
+ 'NAME ' => $ type ,
394
417
]
395
418
);
396
419
397
420
if ($ key === 'json_ld ' )
398
421
{
399
422
$ this ->template ->assign_block_vars (
400
- sprintf ('SEO_METADATA.%s ' , strtoupper ( $ key ) ),
423
+ sprintf ('SEO_METADATA.%s ' , $ type ),
401
424
[
402
425
'CONTENT ' => json_encode ($ data [$ key ], JSON_UNESCAPED_SLASHES )
403
426
]
@@ -409,7 +432,7 @@ public function metadata_template_vars()
409
432
foreach ($ value as $ k => $ v )
410
433
{
411
434
$ this ->template ->assign_block_vars (
412
- sprintf ('SEO_METADATA.%s ' , strtoupper ( $ key ) ),
435
+ sprintf ('SEO_METADATA.%s ' , $ type ),
413
436
[
414
437
'PROPERTY ' => $ k ,
415
438
'CONTENT ' => $ v
0 commit comments