link-preview
This article is a stub. You can help the IndieWeb wiki by expanding it.
A link preview is what posts show about one or more embedded links, e.g. a headline, image, summary from the link destination.
Link previews are similar to reply contexts, and share many of the same techniques and tools.
Why
Consider showing a link-preview so your reader has some expectation of what they're going to get when they click a link.
How to
How to publish
By using an auto-embed function (like the CASSIS "auto_link" (not a typo) function), you can provide inline embedded images and videos in your plain text notes that have links.
If you do the usual mark-up your posts with h-entry, specifically:
p-name
"p-author h-card"
(with at leastp-name
,u-url
,u-photo
)u-featured
(if any)
And for photo posts, the usual:
u-photo
Then link-preview parsers will be able to use those to generate link previews of your posts.
See also: http://microformats.org/wiki/link-preview-brainstorming#publishing
How to parse
To parse a link for information to show in its link-preview, do the usual
- parse for an h-entry
Then get the following information from the following microformats parsed properties:
name
summary
(if any), otherwise, text-only value ofcontent
, elided as necessaryauthor
(name
,photo
,url
)- image
- from
featured
if any - else
photo
if any
- from
See also: http://microformats.org/wiki/link-preview-brainstorming#parsing
indieweb approaches
A few indieweb sites are figuring out how to better support embedding:
- Tantek: I'm thinking of improving the posting UI on my site, so that when I'm previewing a post before PuSHing and syndicating it out, the post preview UI retrieves the link preview(s) on the server, and then shows them to me as part of the overall post preview before I hit the "Publish" button. When I hit the "Publish" button, the same logic which makes a syndicated copy to Twitter (by calling the Twitter API), and then saves the Twitter copy permalink in my data store, can also save the link preview(s) in the same data store accordingly. just piggybacking the same data store write to file call.
- This is similar to another thing I’ve had on my implementation list for a while, which is a better quoting UI. Specifically, my posting UI detects URIs in my content, loads up previews, allows me to D&D in for link previews, perhaps load the content and allow me to select, D&D for quotations --Waterpigs.co.uk 13:23, 7 March 2013 (PST)
- Kevin Marks built a utopian idea that iframes the site itself as a preview, relying on it using responsive design
- Marty McGuire experimented with replacing bare URLs in the content of posts with an h-cite containing their link preview.
- Example post(archive.org version)
- However, content within the h-cite would show up in subsequent link-previews of this post. IRC Example
- For now, moved link-previews outside of
p-name
ande-content
. In markup terms, this means that a link-preview appears after the content that refers to it, and the original URL remains in place (converted to a clickable URL). This is similar to Twitter's link-previews.
Silo Examples
Various social network silos (e.g. Facebook, Twitter, Google+) show link previews underneath notes and comments that have one or more URLs, by extracting information from those URLs content and showing a title/summary/photo for those URLs underneath the posted note/comment.
Facebook uses OGP from the first link in a post, e.g.: [1]
- Supports showing a link-preview of a tweet link, including text of tweet and image in tweet if any, e.g. with one image: [2]
Facebook has a number of guidelines regarding images in their documentation:
They show different link-preview layouts for images of different resolutions!
- Large ( > 600x315px - both dimensions? > 1200 x 630 preferred "for the best display on high resolution devices")
- image is shown above text from link preview
- Small ( < 600x315px - either dimension? but > 200x200px both dimensions?)
- image is shown next to text from link preview
- None ( < 200x200px - either dimension? )
- no image preview possibly?
There are third-party guidelines that does not follow Facebook's own though:
- AddThis: http://support.addthis.com/customer/portal/articles/1399895-adding-open-graph-tags-using-blogger Suggest including Blogger-thumbnail as image, which by default is 72x72px.
Pinterest uses OGP, Microformats, and Schema.org for their "Rich Pins"
Twitter uses their own white-list-domain limited meta + OGP AKA "Twitter Cards" on the last link in a tweet, e.g.: [3]
As of (2015?) Twitter *does* support showing a link-preview of a tweet link, e.g. https://twitter.com/t/status/520758106838818816 (they previously didn't)
However, Twitter fails to show a link-preview for many links, resulting in odd link-only cross-posts from Facebook, where presumably the author did see a link-preview (because Facebook looks at far more information for the link-preview than Twitter does)
Slack
They call creating link previews “unfurling” a URL. They support oEmbed and OGP (including twitter extensions), as documented in this blog post.
- Slack shows link previews for every link in a post that it can find information for by default, and then allows the author to selectively remove link previews for specific links, while composing a post, or later when editing a post.
Previous Silo Examples
- Google+ uses an assortment of microformats/meta/schema/OGP+
...
- ... who's next to make up their own site-specific link preview markup convention?
other link preview standards
There have been a couple of open standards created explicitly for information for link previews.
- oEmbed - since 2009. However it requires an extra endpoint (URL, different language(s) etc.)
- OGP - far more well established since it works in HTML, and Facebook immediately shows results using it.
See http://microformats.org/wiki/link-preview-formats for more prior art research.
simple link preview standard
h-entry is a useful building block for this. E.g.
<body class="h-entry">
is a good simple baseline way to markup data for link previews.
- Jacky Alciné I think this is a bit aggressive of an approach. Wrapping the intended content in
<article>
,<section>
or even a last resort<div>
would be more semantic and wouldn't lead to unintended bugs in full page processing of MF2
For more details towards the development of a simple link preview standard, see:
brainstorming
auto link preview
If you are unable to load a URL, you could still use an auto-url-summary to generate a synthetic text auto link preview.
featured image
Beyond h-entry's existing properties, there may be a need for additional properties to satisfy the same use-cases as documented by the "existing silo support" above.
E.g. most commonly, a thumbnail image to put next to a post, or rather as a publisher to provide a thumbnail / representative / featured image for others to display as part of a link-preview.
WordPress has good prior art here:
http://codex.wordpress.org/Post_Thumbnails:
Post Thumbnail, now Featured Image, is an image that is chosen as the representative image for Posts, Pages or Custom Post Types. The display of this image is up to the theme. This is especially useful for "magazine-style" themes where each post has an image.
Emphasis and emphasis added.
u-featured
Thus we can learn from the WordPress's experience and go with their naming of "Featured Image" - although we can simplify that - why limit to an image when some may (and do!) want to feature a video, or an audio playback stream, etc. as demonstrated by the variety of Twitter Cards?
Thus we can introduce a "featured" property for this use-case, expected to be used as a "u-featured" property inside an h-entry that is a URL to the asset to feature for that post. Handling of different types is up to the link-preview displaying client. E.g. it could do different things based on Content-Type
of the URL when requested, or check its file extension (e.g. .gif .jpg .png .mov .mpeg .mp4 .mp3) and provide markup accordingly, just as existing autoembed solutions do.
summary text limits
Link preview text (e.g. from the "summary" property) may appear in a variety of contexts, and it’s worth considering limiting the length of your link preview text so that it will fit well in such contexts.
There’s some anecdotal experience that eliding at ~200 characters works well. More specific information welcome (screenshots, what various sites/services show for link previews) to provide more specific guidance.
which link to preview
When a post has multiple links, software, services, and silos are inconsistent about which link is (or links are) shown in a link preview in a footer of/after the post.
There are several approaches:
Shows
- only first link: #Facebook, #Mastodon
- only last link: #Twitter
- all links by default (users can remove individual previews): #Slack
Possible publisher solution:
A publisher could use #u-featured as proposed above on the link they want a link preview shown for at the bottom of the post.
A publisher could also use the u-featured
class name on multiple links, and then the consuming code would again have to decide which to show if they only want to show one. Or we could explicitly say in the case of multiple u-featured links, and the consuming code can only display one, use the first one.
implementation wishlist
It seems like an indieweb implementation of a "link preview" feature would need:
- Open way to markup the info on pages that we want to go into a preview (obv min: name, summary, photo). See "simple link preview standard" above.
- OSS library that retrieves a page and generates simple embeddable preview markup. Such a library would return you the markup snippet with preview name/summary/photo - you just need to store that however you store information in your posts, so you can retrieve it from your store rather than the external URL. Ideally the markup snippet returned would support the same format as in #1 so it is completely re-usable without loss of fidelity.
- Exercise for each indieweb implementer: code to store/cache that embeddable markup in your personal post data store so that you can redisplay it without having to rerequest the external URL (has the advantage of snapshotting the preview as of the time you posted the note in case the external URL content changes or dies).
Utilities:
- Link preview validator/previewer - a validator which would parse a URL and show you what preview might result. Note that Twitter has a Twitter Card validator (login required) - we just need to build an indieweb version of it (and not require login).
See Also
- cards
- h-entry
- POSSE
- silos
- microformats
- every silo has their own way of looking for these, so one page can have a different preview per silo: http://www.kevinmarks.com/partialsilos.html
- https://blog.wikimedia.org/2018/04/18/how-we-designed-page-previews-for-wikipedia/ and https://blog.wikimedia.org/2018/04/20/why-it-took-a-long-time-to-build-that-tiny-link-preview-on-wikipedia/
- IndieWeb example: https://adamdawkins.uk/2019/1/31/d79b0152-this-might-just-be-my-favourite-commons-speech-of-all-time-thank-you-jessphillips-https-www-theguardian-com-global-video-2019-jan-31-j
- "This might just be my favourite commons speech of all time. Thank you @jessphillips
https://www.theguardian.com/global/video/2019/jan/31/jess-phillips-on-skilled-workers-ive-met-high-earners-with-literally-no-discernible-skills" https://adamdawkins.uk January 31, 2019
- "This might just be my favourite commons speech of all time. Thank you @jessphillips
- https://mstdn.io/@alexl/101739235357491199
- "How in my opinion #Mastodon should display other #ActivityPub object types like Article, Page and... Link?" @alexl March 12, 2019
- https://medium.com/slack-developer-blog/everything-you-ever-wanted-to-know-about-unfurling-but-were-afraid-to-ask-or-how-to-make-your-e64b4bb9254
- 2020-04-14 This Social Image was Generated
- Criticism: 2020-10-28 WIRED: [https://www.wired.com/story/new-research-reveals-the-hidden-downsides-of-link-previews
- 2020-10-25 Link Previews: How a Simple Feature Can Have Privacy and Security Risks
- ^ 2020-10-26 Ars Technica: Study shows which messengers leak your data, drain your battery, and more
- Minimal Social Markup (2022-10-19) for Twitter, LinkedIn, Facebook, Signal, WhatsApp, in 4 meta elements
- 2019-12-15 : Microbrowsers are Everywhere (archived):
Microbrowsers are a class of User-Agents that also visit website links, parse HTML and generate a user experience. […] The experience is not intended to be interactive. Rather the experience is intended to be representational - to give the user a hint of what exists on the other side of the URL.
As more of our conversations happen in group chats and slack channels, link previews are an important way for you to engage users before they start the journey on your site. […] To help users take the leap and visit your site, we need to make sure that all our pages are annotated with microdata. Better yet, we can use these previews to create compelling visual summaries.
- 2019-12-17 : “[…] it’s not a “microbrowser” (already an alias for mobile browser¹) #xkcd386” (archived) points out it is a good thing to identify, but it should have been given a name that did not already exist:
Instead, when naming something, start with trying a name that is descriptive. E.g. as the @24ways article already mentions “link preview” as the canonical phrase for the thing that is generated and shown, it makes more sense to define “link preview agent” as:
“a class of User-Agents that also visit website links, parse HTML and generate a [non-interactive, representative] user experience”
- 2019-12-17 : “[…] it’s not a “microbrowser” (already an alias for mobile browser¹) #xkcd386” (archived) points out it is a good thing to identify, but it should have been given a name that did not already exist:
- simple design example of preview image showing some text content of the preview: https://jakelazaroff.com/words/web-components-will-outlive-your-javascript-framework/
- 2023/SD/opengraphpublishing