Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Fix cloaked link OG image

Steven Teydaac0f802263
diff --git a/apps/web/app/cloaked/[url]/page.tsx b/apps/web/app/cloaked/[url]/page.tsx
index 1289fcdc91..11cc2d1841 100644
--- a/apps/web/app/cloaked/[url]/page.tsx
+++ b/apps/web/app/cloaked/[url]/page.tsx
@@ -21,7 +21,7 @@ export async function generateMetadata({
return constructMetadata({
title: metatags.title,
description: metatags.description,
- image: metatags.image || undefined,
+ image: metatags.image,
icons: `${GOOGLE_FAVICON_URL}${apexDomain}`,
noIndex: true,
});
diff --git a/packages/utils/src/functions/construct-metadata.ts b/packages/utils/src/functions/construct-metadata.ts
index 5880e71312..c8b3504308 100644
--- a/packages/utils/src/functions/construct-metadata.ts
+++ b/packages/utils/src/functions/construct-metadata.ts
@@ -28,7 +28,7 @@ export function constructMetadata({
}: {
title?: string;
description?: string;
- image?: string;
+ image?: string | null;
icons?: Metadata["icons"];
noIndex?: boolean;
} = {}): Metadata {
@@ -38,17 +38,21 @@ export function constructMetadata({
openGraph: {
title,
description,
- images: [
- {
- url: image,
- },
- ],
+ ...(image && {
+ images: [
+ {
+ url: image,
+ },
+ ],
+ }),
},
twitter: {
- card: "summary_large_image",
title,
description,
- images: [image],
+ ...(image && {
+ card: "summary_large_image",
+ images: [image],
+ }),
creator: "@dubdotco",
},
icons,