Implemented Add MediaObject structured data


Well-known member
Something like this? (media_view)

<script type="application/ld+json">
  "mainEntityOfPage": {
    "@id":"{xen:link 'canonical:xengallery', $media, 'page={$page}'}"
  "image": {
    "url":"{xen:link 'canonical:xengallery/full', $media}"
  "datePublished":"{xen:date $media.media_date, 'Y-m-dTh:m:s+01:00'}'}",
  "interactionStatistic": {
    "userInteractionCount": "{xen:number $media.comment_count}"
Last edited:
Upvote 0
This suggestion has been implemented. Votes are no longer accepted.

Chris D

XenForo developer
Staff member
This has been added to XF2 already.

We use ImageObject for images:

MediaObject for embeds:

And for videos:

And AudioObject for audio:

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.


Well-known member
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.


Well-known member
@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.
<div class="messageContent" itemscope itemtype="">
            <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>

Last edited:


Well-known member
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?