Automatically embed Mastodon posts from URL

AI-generated summary

Users are discussing the possibility of automatically embedding Mastodon posts in Discourse when a URL is shared, similar to how Twitter posts are embedded. crashfistfighter notes that current OneBox previews are insufficient and that manual iframe embedding is cumbersome and poorly sized. Falco suggests that Mastodon’s default site structure and OpenGraph meta tags make automated oneboxing feasible for text, image, and video posts, and adds the pr-welcome tag to invite contributions. Jagster clarifies that the iframe sizing issue is due to hardcoded dimensions in Mastodon’s embed code, not Discourse, and Jagster questions whether Discourse’s growing federation capabilities could simplify this process. They also express frustration with Discourse’s voting system for feature requests, noting that visibility depends on timing and engagement, and wonder if there’s a better way to surface such requests without resorting to off-topic comments.

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.

As now Discourse is federating, would there be a possibility to embed Mastodon posts easily?

I know the manual trick to fix embed-code given by Mastodon, but it is an ackward way to embed when Xwitter needs just an url…

(meta in Meta: this voting system works only with new requests when posted in right time and catches some discussion. Otherwise… the void is calling. What is solution, other than boosting with useless comments… I don’t know and wondering that is off topic here, but I was too lazy to start new discussion, because I know the used system won’t change)

1 Like