DocsPlugins

Link previews

A card for a link, with the page’s title, description, site and picture, read by your server and never by the reader’s browser.

The link-previews plugin reads a linked page’s head: its OpenGraph title, description and picture, or its plain title. Feeds and Conversations use it for the card under a post or message. To add it:

sluurp plugin add link-previews

It is private by design. The server fetches the page, so the linked site and its trackers never learn who read the message. The picture comes back inside the card, as a JPEG 640 pixels wide, so readers fetch it from your server too. Only public addresses are fetched, and every redirect is checked.

There is nothing to set up in the admin.

In the browser

Anybody signed in may ask for a card:

app.ts
const card = await sluurp.send("/link-preview", { query: { url } });
// { url, title, description, site, image }, the image a data URL, or ""

A card is kept for a day, so asking twice costs nothing.

In another plugin’s server code

server/unfurl.ts
import { card } from "plugin:link-previews";

const { title, description, site, image } = await card(url);

Here image is the picture’s own address, for your code to fetch and keep as it needs. card() throws for a link that isn’t http or https, or that isn’t a page.

View as Markdown