satteri-link-card converts a standalone HTTP or HTTPS URL into a
metadata-rich card while Markdown is processed.
Experimental: The API, generated HTML, CSS class names, and behavior may change incompatibly between releases.
Sätteri is the default Markdown and MDX pipeline in Astro 7. Configure the
plugin through @astrojs/markdown-satteri in astro.config.mjs:
import { satteri } from "@astrojs/markdown-satteri";
import { defineConfig } from "astro/config";
import { satteriLinkCard } from "satteri-link-card";
export default defineConfig({
markdown: {
processor: satteri({
hastPlugins: [satteriLinkCard()],
}),
},
});The plugin emits class names but does not inject CSS. This page uses the optional preset shipped with the package:
import "satteri-link-card/preset.css";The preset can be omitted and replaced with site-specific CSS.
A bare URL must be the only content in a root-level paragraph. The default card shows the resolved title, description, favicon, thumbnail, and hostname when that metadata is available.
https://github.com/ItoShimeji/satteri-linksGitHub - itoshimeji/satteri-links: Link-related plugins for Sätteri.Link-related plugins for Sätteri. Contribute to itoshimeji/satteri-links development by creating an account on GitHub.Set thumbnail to false. The Markdown input does not change.
satteriLinkCard({
thumbnail: false,
});AstroAstro builds fast content sites, powerful web applications, dynamic server APIs, and everything in-between.
Set thumbnail.position to "left".
satteriLinkCard({
thumbnail: { position: "left" },
});
AstroAstro builds fast content sites, powerful web applications, dynamic server APIs, and everything in-between.
The default footer shows only the hostname. Set shortenUrl to false to show
the complete URL.
satteriLinkCard({
shortenUrl: false,
});GitHub - withastro/astro: The web framework for content-driven websites. ⭐️ Star to support our work!The web framework for content-driven websites. ⭐️ Star to support our work! - withastro/astroSet favicon to false.
satteriLinkCard({
favicon: false,
});GitHub - withastro/astro: The web framework for content-driven websites. ⭐️ Star to support our work!The web framework for content-driven websites. ⭐️ Star to support our work! - withastro/astroUse ignoreExtensions to keep selected file URLs unchanged.
satteriLinkCard({
ignoreExtensions: [".pdf", ".mp4"],
});https://example.com/manual.pdfhttps://example.com/manual.pdf
The plugin intentionally leaves the following input unchanged:
- links with authored labels or surrounding text
- URLs in lists, blockquotes, and other nested content
- paragraphs containing more than one link or other content
- non-HTTP(S) URLs
- URLs matched by
ignoreExtensions
Read the [Astro documentation](https://astro.build/).
- https://astro.build/
https://github.com/ItoShimeji/satteri-links https://astro.build/Read the Astro documentation.
https://github.com/ItoShimeji/satteri-links https://astro.build/
Metadata is cached under .cache/satteri-link-card by default. Images remain
remote by default. Configure both caches in the plugin definition:
satteriLinkCard({
metadataCache: {
directory: ".cache/link-cards",
maxAge: 30 * 24 * 60 * 60 * 1000,
},
imageCache: {
maxImageBytes: 5 * 1024 * 1024,
store: createFileSystemImageCacheStore({
directory: "public/link-cards",
publicPath: "/link-cards",
}),
},
});Set metadataCache: false to disable metadata caching. Set imageCache: true
to use the default filesystem store, or provide a custom ImageCacheStore for
another backend.
Metadata and image requests run in the build environment. Requests to private or local network addresses are not currently blocked. Use the plugin with trusted Markdown.
SVG images are not stored by the initial image cache. The package also does not currently provide offline builds, cache pruning, or concurrency limits across different URLs.