How to represent a post/comment as objects in open graph?
-
16-04-2021 - |
Question
One limitation in Open Graph that it accepts only real-world objects like: Movie, Author, News and Band. I would like to use with more non-real-world objects like a post, question or a comment.
There is one entity that might fit in such use which is the Article, but using it for both a post (e.g. blog post) and it's comments would be a little inappropriate.
However there is another not very real-world type which is News I though that this might fit in such use case: Blog Post as Article and it's comments as News, would this be ugly?
La solution
The Open Graph allows you to create any objects and actions you want.
In this case, create a custom object which represents the object the user is commenting on and a custom action "comment". Add a custom property of the comment action which stores the text of the comment.
For posts, you can create a custom object "post" and a custom action "authored" - resulting in stories like "{user} authored {post title}" - you could use wrote, posted etc as alternatives to authored.