JSON-lD Microdata
-
Hi there,
First of; been using your plugin for quite some time.
Since I started looking into JSON-LD and microdata a while back and its benefits for SEO i wanted to also expand this to Decent Comments and it’s comment display.Getting that setup should not be that hard;
adding this in the class-decent-comments-renderer.php in the for each loop for get_comments should work after the closing div tag./**
* Custom JSON-LD Addition for comments
*/
$jsonld_comment_date = get_comment_date(‘c’, $comment->comment_ID);
$jsonld_comment_title = get_the_title($comment->comment_post_ID);
$jsonld_comment_link = get_permalink($comment->comment_post_ID);
$jsonld_comment_discuss_link = get_permalink($comment->comment_post_ID) . ‘#comment-‘ . $comment->comment_ID;
$jsonld_full_comment = $comment->comment_content;$output .= ‘<script type=”application/ld+json”>
{
“@context”: “https://schema.org”,
“@type”: “Comment”,
“comment”: “‘ . $jsonld_full_comment . ‘”,
“text”: “‘ . $jsonld_full_comment . ‘”,
“datePublished”: “‘ . $jsonld_comment_date . ‘”,
“author”: “‘ . $comment->comment_author . ‘”,
“name”: “‘ . $jsonld_comment_title . ‘”,
“about”: “‘ . $jsonld_comment_title . ‘”,
“discussionUrl”: “‘ . $jsonld_comment_discuss_link . ‘”,
“url”: “‘ . $jsonld_comment_link . ‘”
}
</script>’;Sadly when I try to change anything in regard to class-decent-comments-renderer.php it does not seems to take. For reference I am using the widget though.
Any help would be greatly appreciated!
- The topic ‘JSON-lD Microdata’ is closed to new replies.