Improve shared link previews
Build and push image / build (push) Successful in 1m22s

This commit is contained in:
alexandrev-tibco
2026-05-04 22:37:56 +02:00
parent 0ac9b06a6d
commit 9feb7346d4
4 changed files with 12 additions and 6 deletions
+2 -1
View File
@@ -178,12 +178,13 @@ export default function Home() {
await navigator.share({
title: "hidden11",
text: shareText,
url: shareUrl,
});
return;
}
window.open(
`https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`,
`https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}&url=${encodeURIComponent(shareUrl)}`,
"_blank",
"noopener,noreferrer",
);
+8 -2
View File
@@ -24,16 +24,22 @@ export async function generateMetadata({ params }: ResultPageProps): Promise<Met
return {
title: `hidden11 #${payload.puzzleNumber} shared result`,
description: `Shared hidden11 result for puzzle #${payload.puzzleNumber}.`,
alternates: {
canonical: `https://hidden11.app/r/${shareCode}`,
},
openGraph: {
title: `hidden11 #${payload.puzzleNumber}`,
description: "Shared daily result",
images: [`/result/${shareCode}/opengraph-image`],
url: `https://hidden11.app/r/${shareCode}`,
siteName: "hidden11",
images: [`https://hidden11.app/r/${shareCode}/opengraph-image`],
type: "website",
},
twitter: {
card: "summary_large_image",
title: `hidden11 #${payload.puzzleNumber}`,
description: "Shared daily result",
images: [`/result/${shareCode}/twitter-image`],
images: [`https://hidden11.app/r/${shareCode}/twitter-image`],
},
};
}
+2 -1
View File
@@ -30,6 +30,7 @@ export default function ShareResult({ dateKey, locale, onClose, progress, quote,
await navigator.share({
title: "hidden11",
text: shareText,
url: shareUrl,
});
setShared(true);
window.setTimeout(() => setShared(false), 1600);
@@ -37,7 +38,7 @@ export default function ShareResult({ dateKey, locale, onClose, progress, quote,
}
window.open(
`https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`,
`https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}&url=${encodeURIComponent(shareUrl)}`,
"_blank",
"noopener,noreferrer",
);
-2
View File
@@ -25,7 +25,6 @@ type SharePayload = {
};
export function buildShareText(dateKey: string, progress: DailyProgress, t: Dictionary, shareUrl?: string): string {
const resultUrl = shareUrl ?? "https://hidden11.app";
const homeUrl = "https://hidden11.app";
const rows = DIFFICULTIES.map((difficulty) => {
const item = progress[difficulty];
@@ -55,7 +54,6 @@ export function buildShareText(dateKey: string, progress: DailyProgress, t: Dict
...rows,
"",
`Play: ${homeUrl}`,
`Result: ${resultUrl}`,
].join("\n");
}