+
+
+ K
+
+
+ JUSTHTML.SH · DOCUMENT
+
+
+
+
+
+ {preview.imageTitle}
+
+
+ {preview.imageDescription}
+
+
+
+
+
justhtml.sh/d/{doc.slug}
+
{doc.is_public ? "public" : "shared link"}
+
+
+ ),
+ {
+ width: 1200,
+ height: 630,
+ headers: {
+ "Cache-Control": doc.is_public ? "public, max-age=300" : "private, no-store",
+ ...(doc.is_public ? {} : { "X-Robots-Tag": "noindex, nofollow, noimageindex" }),
+ },
+ }
+ );
+}
diff --git a/lib/docs/preview.test.ts b/lib/docs/preview.test.ts
new file mode 100644
index 0000000..1e117a4
--- /dev/null
+++ b/lib/docs/preview.test.ts
@@ -0,0 +1,48 @@
+import { describe, expect, it } from "vitest";
+import { documentPreview, extractPreviewDescription } from "@/lib/docs/preview";
+
+describe("document link previews", () => {
+ it("extracts a standard description regardless of attribute order or quoting", () => {
+ expect(
+ extractPreviewDescription(
+ `