From 9140c458bce768bb4fcab066ac1aaa26556e9b81 Mon Sep 17 00:00:00 2001 From: Elvis Morales Date: Wed, 15 May 2024 07:44:42 -0700 Subject: [PATCH] Update integration-guidelines.md Update the property name to the correct one to obtain the current post object ID; otherwise, it returns nothing. Update the `@type` key; otherwise, it will not appear in the `ld+json` script. --- docs/features/schema/integration-guidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/features/schema/integration-guidelines.md b/docs/features/schema/integration-guidelines.md index 429fd719..999c9c85 100644 --- a/docs/features/schema/integration-guidelines.md +++ b/docs/features/schema/integration-guidelines.md @@ -72,10 +72,10 @@ class Book { public function generate() { $canonical = YoastSEO()->meta->for_current_page()->canonical; - $post_id = YoastSEO()->meta->for_current_page()->post_id; + $post_id = YoastSEO()->meta->for_current_page()->id; // Set the type. - $data['type'] = 'Book'; + $data['@type'] = 'Book'; // Give it a unique ID, based on the URL and the Post ID. $data['@id'] = $canonical . '#/book/' . $post_id; @@ -183,4 +183,4 @@ In the example above, we used `isPartOf`. This is fine if your Schema "piece" is ```json "mainEntityOfPage": { "@id": "" } -``` \ No newline at end of file +```