Posts structured data: set explicit "identifier" and canonical url as "url"

AI-generated summary

The discussion focuses on improving structured data for posts in the Discourse platform. rrit suggests explicitly setting the identifier and url properties in the schema.org model for posts. Currently, posts are identified by their id, and the identifier is derived from the canonical URL, which may not be unique. To ensure uniqueness and consistency, the proposal is to use the canonical URL as the identifier via the itemid attribute and also add it as the url property. This change aims to enhance compatibility with tools like the Google Rich Results Test, as demonstrated by the improved structured data output shown here.

In the structured data model:
Posts are objects on a topic-page and are right now identified by their id-tag. Then the pages canonical-url is somehow used to create an identifier – also see:

Via Google Rich Results Test:

identifier:
https://meta.discourse.org/t/feedback-on-new-hamburger-and-user-menus/post_123

The identifier might be of type URL (IRI for JSON-LD), like it is in this case. This (automatically created) url does not need to match the canonical url of the post itself, it only needs to be unique.
Setting the identifier to the specific value of the canonical url ensures it is unique and should not do any harm.
And one step further: add the canonical url as property url to the post..

Crawler-view: topic page with posts

Current state:

<div id="post_123"
     itemscope="" itemtype="http://schema.org/DiscussionForumPosting"
     class="topic-body crawler-post">
  <div class="crawler-post-meta">
    […]

Using canonical-url as identifier via attribute itemid and setting property url…

<div id="post_123"
     itemid="https://meta.discourse.org/t/feedback-on-new-hamburger-and-user-menus/32519?page=6#post_123"
     itemscope="" itemtype="http://schema.org/DiscussionForumPosting"
     class="topic-body crawler-post">
  <div class="crawler-post-meta">
    <link itemprop="url" href="https://meta.discourse.org/t/feedback-on-new-hamburger-and-user-menus/32519?page=6#post_121">
    […]

… results in: https://search.google.com/test/rich-results/result?id=_k2xr2Uf2tCLTReR69-SLg&hl=en