This week, we're delighted to introduce a new feature in XenForo 2.3 that enhances the way you can share content on your forum. Plus, we'll show you how easy it is to share any content from your forum to other platforms using our new content embedding feature.
While URL unfurling works well for content from other sources, for content already on your forum, we're introducing a new
A minor inconvenience with the unfurl system when sharing content on your forum is that it sometimes misses the context. For example, if you link to a specific forum post, the unfurl system retrieves metadata from the thread instead of the post itself. With our new content embedding system, this issue is resolved. Now, when you want to feature a specific post, the system generates a rich preview of that post, preserving the context and enhancing the viewer's experience:
Of course threads and posts are not the only content supported. You can also embed profile posts:
Resources and resource updates:
And, of course, media items and albums which are mostly the same as they were previously with the existing
You might already be thinking about the possibilities this opens up for developers. As always, developers are welcome to add support for their own content types in the usual way.
We're eager to hear what you think about these updates. But don't go just yet; we've got more to share.
Included in XenForo is a new script named
For a more accessible approach, you can find the embed code for a specific item under the share tooltip (where available):
This version of the embed code looks like this:
This embed code does the same job as the iframe, but with a little extra magic to make sure the iframe sizes itself perfectly to fit the content.
This new ability to externally embed content means you can now implement a BB code media site in your XenForo forum to automatically embed content from other XenForo forums!
Furthermore, starting with XenForo 2.3, we're introducing a new oEmbed endpoint to our REST API. This endpoint doesn't require authentication and is always available. For example, a request to
In addition to oEmbed making it easier to embed your content on other XenForo forums, it will also make it easier to post your content almost anywhere. For example, if you were to get your forum approved by Embed.ly, your content could end up being shared with rich previews on platforms such as Reddit, and many more!
That wraps up this week's HYS! We look forward to hearing your feedback and will be back with more next week.
Rich previews for content
If you're already familiar with URL unfurling, content embedding works similarly. In XenForo 2.2, when you post a link to content on your forum, we perform an HTTP request, download a portion of the content, and extract metadata such as the page title, description, and a logo. If you need a refresher on URL unfurling, you can find our original announcement from XenForo 2.1 here:XF 2.1 - Unfurling URLs, Emoji enhancements and video uploads
Here we go! We're four HYS threads in already and you might be wondering just how many there are left. Well, I can't tell you 😉 But what I can tell you is - we're not even half way through yet! In case you've not yet seen the previous entries, you can check them out here. As ever, to ensure...
xenforo.com
While URL unfurling works well for content from other sources, for content already on your forum, we're introducing a new
[EMBED]
BB code. This fetches a rich preview directly, and is added to your content automatically on save if you paste a link (on its own line). This is what it looks like:A minor inconvenience with the unfurl system when sharing content on your forum is that it sometimes misses the context. For example, if you link to a specific forum post, the unfurl system retrieves metadata from the thread instead of the post itself. With our new content embedding system, this issue is resolved. Now, when you want to feature a specific post, the system generates a rich preview of that post, preserving the context and enhancing the viewer's experience:
Of course threads and posts are not the only content supported. You can also embed profile posts:
Resources and resource updates:
And, of course, media items and albums which are mostly the same as they were previously with the existing
[GALLERY]
tag:You might already be thinking about the possibilities this opens up for developers. As always, developers are welcome to add support for their own content types in the usual way.
We're eager to hear what you think about these updates. But don't go just yet; we've got more to share.
Embedding content anywhere
In addition to improving how you highlight content on your forum, you can now also embed your content on other forums or even non-XF content management systems.Included in XenForo is a new script named
embed.php
. This script allows your content to be rendered anywhere, as long as it's visible to guests. All you need is the content type and ID and an iframe:
HTML:
<iframe src="https://xenforo.com/community/embed.php?content=thread-216767" frameborder="0" width="560"></iframe>
For a more accessible approach, you can find the embed code for a specific item under the share tooltip (where available):
This version of the embed code looks like this:
HTML:
<div class="js-xf-embed" data-url="https://xenforo.com/community" data-content="thread-216767"></div>
<script defer src="https://xenforo.com/community/js/xf/external_embed.js?_v=ab87d886"></script>
This new ability to externally embed content means you can now implement a BB code media site in your XenForo forum to automatically embed content from other XenForo forums!
Furthermore, starting with XenForo 2.3, we're introducing a new oEmbed endpoint to our REST API. This endpoint doesn't require authentication and is always available. For example, a request to
https://xenforo.com/community/api/oembed/?url=https%3A%2F%2Fxenforo.com%2Fcommunity%2Fthreads%2Fboosting-performance-in-xenforo-2-3.216767%2F
will produce the output:
JSON:
{
"version": "1.0",
"type": "rich",
"provider_name": "XenForo community",
"provider_url": "https://xf.deemit.site/community",
"author_name": "Chris D",
"author_url": "/community/members/chris-d.11388/",
"html": "<div class=\"js-xf-embed\" data-url=\"https://xenforo.com/community\" data-content=\"thread-216767\"></div><script defer src=\"https://xenforo.com/community/js/xf/external_embed.js?_v=ab87d886\"></script>",
"referrer": "",
"cache_age": 3600
}
In addition to oEmbed making it easier to embed your content on other XenForo forums, it will also make it easier to post your content almost anywhere. For example, if you were to get your forum approved by Embed.ly, your content could end up being shared with rich previews on platforms such as Reddit, and many more!
That wraps up this week's HYS! We look forward to hearing your feedback and will be back with more next week.