The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update sitemap
Steven Tey566c37723293
diff --git a/apps/web/app/robots.ts b/apps/web/app/robots.tsindex 4a91797b51..3741e262d7 100644--- a/apps/web/app/robots.ts+++ b/apps/web/app/robots.ts@@ -1,9 +1,15 @@+import { SHORT_DOMAIN } from "@dub/utils";import { MetadataRoute } from "next";import { headers } from "next/headers";export default function robots(): MetadataRoute.Robots {const headersList = headers();- const domain = headersList.get("host") as string;+ let domain = headersList.get("host") as string;++ if (domain === "dub.localhost:8888" || domain.endsWith(".vercel.app")) {+ // for local development and preview URLs+ domain = SHORT_DOMAIN;+ }return {rules: {diff --git a/apps/web/app/sitemap.ts b/apps/web/app/sitemap.tsindex f264497a1a..ab7df18fb1 100644--- a/apps/web/app/sitemap.ts+++ b/apps/web/app/sitemap.ts@@ -1,4 +1,5 @@import prisma from "@/lib/prisma";+import { SHORT_DOMAIN } from "@dub/utils";import { MetadataRoute } from "next";import { headers } from "next/headers";@@ -6,29 +7,28 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {const headersList = headers();let domain = headersList.get("host") as string;- const links = await prisma.link.findMany({+ if (domain === "dub.localhost:8888" || domain.endsWith(".vercel.app")) {+ // for local development and preview URLs+ domain = SHORT_DOMAIN;+ }++ const data = await prisma.domain.findUnique({where: {- domain,- publicStats: true,+ slug: domain,},select: {- domain: true,- key: true,- },- orderBy: {- clicks: "desc",+ target: true,},- take: 100,});+ if (!data || !data.target) {+ return [];+ }+return [{url: `https://${domain}`,lastModified: new Date(),},- ...links.map(({ key }) => ({- url: `https://${domain}/stats/${key}`,- lastModified: new Date(),- })),];}