From 95d80cc7d761e06cc052bf4acd09115767c56415 Mon Sep 17 00:00:00 2001
From: Marc Mintel
Date: Sun, 22 Feb 2026 12:53:05 +0100
Subject: [PATCH] feat(blog): extract and display Open Graph link previews in
global ShareModal
---
apps/web/src/components/ShareModal.tsx | 49 +++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
diff --git a/apps/web/src/components/ShareModal.tsx b/apps/web/src/components/ShareModal.tsx
index f84884a..d93883e 100644
--- a/apps/web/src/components/ShareModal.tsx
+++ b/apps/web/src/components/ShareModal.tsx
@@ -25,6 +25,10 @@ export function ShareModal({
}: ShareModalProps) {
const [copied, setCopied] = useState(false);
const [imagePreview, setImagePreview] = useState(null);
+
+ // Open Graph data for global article sharing
+ const [ogData, setOgData] = useState<{ image?: string, title?: string, description?: string } | null>(null);
+
const [timestamp] = useState(
new Date().toLocaleTimeString("de-DE", {
hour: "2-digit",
@@ -33,6 +37,19 @@ export function ShareModal({
}),
);
+ useEffect(() => {
+ // Only extract OG data if we are sharing the global page (no specific diagram or QR)
+ if (isOpen && !diagramImage && !qrCodeData && typeof document !== "undefined") {
+ const ogImage = document.querySelector('meta[property="og:image"]')?.getAttribute("content") || undefined;
+ const ogTitle = document.querySelector('meta[property="og:title"]')?.getAttribute("content") || title;
+ const ogDesc = document.querySelector('meta[property="og:description"]')?.getAttribute("content") || undefined;
+
+ if (ogImage || ogTitle || ogDesc) {
+ setOgData({ image: ogImage, title: ogTitle, description: ogDesc });
+ }
+ }
+ }, [isOpen, diagramImage, qrCodeData, title]);
+
useEffect(() => {
if (diagramImage && isOpen) {
const isDataUrl = diagramImage.startsWith("data:image/");
@@ -194,7 +211,7 @@ export function ShareModal({
) : (
- title && (
+ title && !ogData ? (
+ ) : ogData && (
+
+
+
+ {ogData.image && (
+
+

+
+ )}
+
+
+ {ogData.title || title}
+
+ {ogData.description && (
+
+ {ogData.description}
+
+ )}
+
+ MINTEL.ME
+
+
+
+
)
)}