Implemented Add MediaObject structured data

dutchbb

Well-known member
Something like this? (media_view)

Code:
<script type="application/ld+json">
{
  "@context":"http://schema.org",
  "@type":"MediaObject",
  "mainEntityOfPage": {
    "@type":"WebPage",
    "@id":"{xen:link 'canonical:xengallery', $media, 'page={$page}'}"
  },
  "headline":"{$media.media_title}",
  "image": {
    "@type":"ImageObject",
    "url":"{xen:link 'canonical:xengallery/full', $media}"
  },
  "datePublished":"{xen:date $media.media_date, 'Y-m-dTh:m:s+01:00'}'}",
  "interactionStatistic": {
    "@type":"InteractionCounter",
    "interactionType":"http://schema.org/CommentAction",
    "userInteractionCount": "{xen:number $media.comment_count}"
  }
}
</script>
 
Last edited:
Upvote 0
This suggestion has been implemented. Votes are no longer accepted.
This has been added to XF2 already.

We use ImageObject for images:
https://search.google.com/structure...ro.com/community/media/pexels-photo-jpg.2166/

MediaObject for embeds:
https://search.google.com/structure...-%C3%87inli-halk-t%C3%BCrk%C3%BCs%C3%BC.2139/

And for videos:
https://search.google.com/structure....com/community/media/lily-likes-animoji.2047/

And AudioObject for audio:
https://search.google.com/structure...xenforo.com/community/media/kalimba-mp3.1903/

Why don't we use VideoObject for videos? Good question. It never worked. Although we met all of the requirements for the VideoObject structured data, we could never get it to successfully verify in the structured data testing tool. So we use MediaObject instead, and I check periodically whether anything has changed but alas the errors keep being reported so it's likely best we stick with MediaObject for now.
 
Great! ;) (forgot to check xf2).

Yeah i tried VideoObject also for youtube (in threads) but no luck. In media gallery did not try, but MediaObject is also fine for video's.
 
@Chris D

Would it be an idea to use ImageObject for attachments in posts? Not sure if video's and proxy images can be done like that.

Like so, or 'Thing' -> itemprop="image" because no extra data is given.
Code:
<div class="messageContent" itemscope itemtype="http://schema.org/ImageObject">
      <article>
            <blockquote class="messageText SelectQuoteContainer ugc baseHtml">

Echt of nep?
<br /><br />
<img src="http://..." itemprop="image" alt="20180403_022649.jpg" class="bbCodeImage LbImage" />
<br /><br />
<img src="http://..." itemprop="image" alt="20180403_022701.jpg" class="bbCodeImage LbImage" />
<br /><br />
<img src="http://" itemprop="image" alt="20180403_022711.jpg" class="bbCodeImage LbImage" />
               
                    <div class="messageTextEndMarker">&nbsp;</div>
              </blockquote>
          </article>

  </div>
 
Last edited:
ImageObject with the width and height would be best i think.

Why is ask is because for DiscussionForumPosting an image can be used in search results. At the moment the thread starter avatar or logo is used but is sometimes to small. Google states it could use an image from the article/thread instead.

Using ImageObject with extra data like dimensions could increase the chance maybe?
 
Top Bottom