Automatically embed Mastodon posts from URL

Hi there,

my community shares a lot of Mastodon posts. Although the resulting OneBox gives a preview of the post, users typically need to click through to see the full post and any embedded media. Alternatively, users could do a few more clicks to copy the embed code, but this rarely happens and comes with the downside that each instance needs to be added to the iframe whitelist and that the size of the iframe is not adjusted to fit its contents—you need to scroll the post. Is there any way to automate embedding Mostodon posts when a URL is posted to Discourse (similar to how this is being done for tweets)?

Cheers

3 Likes

Looks like we can easily detect a default mastodon site body > div#mastodon and create good oneboxes for text, image and video posts as all the info we need is present in the meta opengraph tags. Putting the pr-welcome tag here.

3 Likes

Manually is. The embed misses height (or was it width?) and that’s why it doesn’t work on Discourse. Those sizes are kind of hardcoded anyway. I would blaime Mastodon.