The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Added dynamic OG images for changelog, fix index thumbnail
Steven Tey60e4a5f223d5
diff --git a/app/dub.sh/changelog/opengraph-image.png b/app/dub.sh/changelog/opengraph-image.pngdeleted file mode 100644index 193475024a..0000000000Binary files a/app/dub.sh/changelog/opengraph-image.png and /dev/null differdiff --git a/app/dub.sh/changelog/page.tsx b/app/dub.sh/changelog/page.tsxindex 71e5f4f4c6..79a7cd9a1f 100644--- a/app/dub.sh/changelog/page.tsx+++ b/app/dub.sh/changelog/page.tsx@@ -8,10 +8,30 @@ import { MDX } from "#/ui/blog/mdx";import { Twitter } from "@/components/shared/icons";import { Rss } from "lucide-react";+const title = "Changelog - Dub";+const description =+ "All the latest updates, improvements, and fixes to Dub - the link management tool for modern marketing teams.";+const image = "https://dub.sh/api/og/changelog";+export const metadata: Metadata = {- title: "Changelog - Dub",- description:- "All the latest updates, improvements, and fixes to Dub - the link management tool for modern marketing teams.",+ title,+ description,+ openGraph: {+ title,+ description,+ images: [+ {+ url: image,+ },+ ],+ },+ twitter: {+ title,+ description,+ images: [image],+ },+ metadataBase: new URL("https://dub.sh"),+ themeColor: "#FFF",};export default async function Changelog() {diff --git a/app/layout.tsx b/app/layout.tsxindex b521e1a130..c4d0f7e7cd 100644--- a/app/layout.tsx+++ b/app/layout.tsx@@ -7,14 +7,25 @@ import { Providers } from "./providers";const title = "Dub - Link Management for Modern Marketing Teams";const description ="Dub is an open-source link management tool for modern marketing teams to create, share, and track short links.";+const image = "https://dub.sh/_static/thumbnail.png";export const metadata = {title,description,+ openGraph: {+ title,+ description,+ images: [+ {+ url: image,+ },+ ],+ },twitter: {card: "summary_large_image",title,description,+ images: [image],creator: "@dubdotsh",},metadataBase: new URL("https://dub.sh"),diff --git a/app/opengraph-image.png b/app/opengraph-image.pngdeleted file mode 100644index 068f83422e..0000000000Binary files a/app/opengraph-image.png and /dev/null differdiff --git a/package.json b/package.jsonindex eee2367f16..253e06f621 100644--- a/package.json+++ b/package.json@@ -1,5 +1,5 @@{- "private": false,+ "private": true,"license": "AGPL-3.0-or-later","scripts": {"dev": "next dev",diff --git a/pages/api/og/changelog.tsx b/pages/api/og/changelog.tsxnew file mode 100644index 0000000000..ad90c73776--- /dev/null+++ b/pages/api/og/changelog.tsx@@ -0,0 +1,90 @@+import { ImageResponse, NextRequest } from "next/server";+import { allChangelogPosts } from "contentlayer/generated";+import { formatDate } from "@/lib/utils";++export const runtime = "edge";+export const contentType = "image/png";++const satoshiBold = fetch(+ new URL("@/styles/Satoshi-Bold.ttf", import.meta.url),+).then((res) => res.arrayBuffer());++const interMedium = fetch(+ new URL("@/styles/Inter-Medium.ttf", import.meta.url),+).then((res) => res.arrayBuffer());++export default async function handler() {+ const [satoshiBoldData, interMediumData] = await Promise.all([+ satoshiBold,+ interMedium,+ ]);++ const post = allChangelogPosts.sort((a, b) => {+ if (new Date(a.publishedAt) > new Date(b.publishedAt)) {+ return -1;+ }+ return 1;+ })[0];++ return new ImageResponse(+ (+ <div+ style={{+ height: "100%",+ width: "100%",+ display: "flex",+ flexDirection: "column",+ alignItems: "center",+ backgroundColor: "white",+ fontFamily: "Inter Medium",+ }}+ >+ <img+ src={new URL(+ "../../../public/_static/logotype.png",+ import.meta.url,+ ).toString()}+ style={{+ height: "40px",+ position: "absolute",+ top: "20px",+ left: "20px",+ }}+ />+ <div tw="flex flex-col text-left pt-20 pb-10 pl-80 border-b border-gray-200 w-full">+ <h1+ style={{+ fontFamily: "Satoshi Bold",+ }}+ tw="text-5xl font-bold text-black"+ >+ Changelog+ </h1>+ <p tw="text-lg text-gray-500">+ All the latest updates, improvements, and fixes to Dub.+ </p>+ </div>+ <div tw="flex w-full pt-10 pl-28">+ <p tw="text-gray-500">{formatDate(post.publishedAt)}</p>+ <div tw="flex flex-col ml-24">+ <img src={post.image} tw="rounded-lg h-96 object-cover" />+ </div>+ </div>+ </div>+ ),+ {+ width: 1200,+ height: 630,+ fonts: [+ {+ name: "Satoshi Bold",+ data: satoshiBoldData,+ },+ {+ name: "Inter Medium",+ data: interMediumData,+ },+ ],+ },+ );+}diff --git a/public/_static/logotype.png b/public/_static/logotype.pngnew file mode 100644index 0000000000..8b5c3ee741Binary files /dev/null and b/public/_static/logotype.png differdiff --git a/static/media/background.681e0321.png b/static/media/background.681e0321.pngdeleted file mode 100644index 8a58dc2686..0000000000Binary files a/static/media/background.681e0321.png and /dev/null differdiff --git a/static/media/logo.99d7a2d3.png b/static/media/logo.99d7a2d3.pngdeleted file mode 100644index 1653c4e3cd..0000000000Binary files a/static/media/logo.99d7a2d3.png and /dev/null differdiff --git a/styles/Inter-Medium.ttf b/styles/Inter-Medium.ttfnew file mode 100644index 0000000000..9a3396fc43Binary files /dev/null and b/styles/Inter-Medium.ttf differ