-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Originally filed as mastodon/mastodon#35717.
When user-facing ActivityStreams services render objects with HTML content
, they often generate a link preview for links (<a>
tags) in it. That's great! ...except for when they're not wanted. Some links are sensitive, or not informationally useful, or won't have good preview metadata. It'd be nice for services that create and federate objects to be able to specify which content links shouldn't get a preview. Maybe with rel=nopreview
, which doesn't exist yet, or a similar class?
Evidently rel=tag
, class=u-url
, class=h-card
currently have this effect in some fediverse implementations. They're not ideal, since they carry semantics, and they're not officially supported for this use, but it's a start.
From https://discord.com/channels/231908446830723072/734716731150303242 :
A: One idea was that it should be based on if there's a Link object attached or not, but by the sounds of it, Mastodon will generate a link preview from just the content?
A: Another idea was maybe rel="nopreview" but that's not currently a thing within HTML
B: lol rel=nopreview is one thing I was thinking. great minds, etc
B: could also (re)use rel=nofollow 🤷♂️
B: yeah Mastodon generates previews from tags in content alone
A: Oh, interesting, looks like it doesn't even pay attention to the Link attachments
A: as a hack you could mark the links with class="u-url"
C: Twitter used to generate previews based on the last URL in the body of the text (and save those as cards in the backend). A Tweet could only have one type of attachment though, so if an image was also included in the post, it would override the link preview. I mention this because Mastodon had similar behaviours to Twitter at the beginning - I have not look at what the current implementation does.
C: that's not a way to suppress a link preview in a text-only post, regardless.
D: Some accounts do exactly that to avoid the thundering herd problem of thousands of servers all connecting at once to generate the preview.
B: should I file an issue? there are a few existing issues, but afaict all of them are for Mastodon users or admins, not for external services federating into Mastodon
E:rel=tag
orclass=u-url
orclass=h-card
will currently skip link preview generation but none of these are specifically designed to suppress them, ifrel=nopreview
is a real thing I'd be happy to add support for it
swicg/activitypub-trust-and-safety#97 is related, as are mastodon/mastodon#20188, mastodon/mastodon#23612, mastodon/mastodon#24015, mastodon/mastodon#30802.