LinkPreview

A link preview component.

This component creates a link preview displaying the link text, an optional description and an optional OG image. It is geared towards displaying internal links, e.g. to a blog post. But it can also be used for external links.

This component cannot fetch link metadata on its own due to a browser’s same origin policy. Reading link metadata needs to be done server-side by the SvelteKit application that consumes this component.

Props

A LinkPreview component has the following properties:

PropRequiredDescription
valueyesLink meta data of type LinkMeta.
classnoAdditional Tailwind classes.

Examples