tomusborne / generatepress

452 stars 89 forks source link

Schema - Google Improve Item appearance for comments-area and comment_author_link() #588

Open diggeddy opened 12 months ago

diggeddy commented 12 months ago

Description

Coming to a blog near you, every GSC console will recommend the following improvements:

Screenshot 2023-11-29 at 12 48 26

Although these add absolutely zero value and have no impact on a search result Rich Snippet; google in their wisdom thought it best that any user who has comments on a blog post should be subject to a code Yellow warning like theres an approaching hurricane in your neighbours backyard.

This is has come about through their implantation of DiscussionForumPosting schema. See references for example

Now this unfortunately affects Comments and we need to:

  1. Use generate_get_microdata to add itemtype="https://schema.org/CreativeWork to the comments-area

https://github.com/tomusborne/generatepress/blob/513d21a557da677cd02f1a82af5f550f2781618c/inc/structure/comments.php#L226

  1. add itemprop="url" to the <a> that is returned from the get_comment_author_link() used here:

https://github.com/tomusborne/generatepress/blob/513d21a557da677cd02f1a82af5f550f2781618c/inc/structure/comments.php#L43

References

https://developers.google.com/search/docs/appearance/structured-data/discussion-forum#json-ld%20example

Support topic related to issue: https://generate.support/topic/comment-object-must-be-nested-inside-a-creativework-object-2/#post-67247