jkap
@jkap

writing this down since afaict it's not documented literally anywhere.

if you've updated to iOS 16.4 or macOS 13.3, you may have noticed that iMessage is able to have non-awful link previews for Mastodon posts.

screenshot of the new Mastodon preview format in iMessage. you can actually see the post!

this matches the behavior iMessage has for Twitter URLs, but unfortunately this doesn't apply by default to other links. while the display of standard opengraph links has improved somewhat, it's still bad.

screenshot of a cohost link preview in iMessage. it's just the username and their icon, no actual indication as to the content of the post.

this begged the question: how is iMessage actually determining if a link is a mastodon post and using the new behavior?

SPOILER: it is straight up just looking for a <link /> tag. adding one with the right shape, even if the href is a complete lie, is enough for iMessage to switch to the new style (it doesn't follow the URL, it's still using the opengraph tags for its preview).

<link rel="alternate" type="application/activity+json" href="this literally doesn't matter" />
syntax highlighting by codehost

since cohost is already using opengraph for metadata, all we need to do is add that tag and it works as we want:

screenshot of a cohost link preview in iMessage. it actually has a preview of the post now!

obviously adding the tag with incorrect data at the link is bad etiquette, so you don't just want to add the tag and call it a day. i mean you can, but you shouldn't. it's rude.

anyway: this will ship hopefully today or tomorrow. hope this helped if you're doing something similar


You must log in to comment.

in reply to @jkap's post: