The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Inline program lander indexing checks into the apply layout
Kiran K7e72c4a25cef
diff --git a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/layout.tsx b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/layout.tsxindex ff7e9b1667..41e1e1d9b9 100644--- a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/layout.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/layout.tsx@@ -1,7 +1,6 @@import { getProgram } from "@/lib/fetchers/get-program";import { getProgramSlugs } from "@/lib/fetchers/get-program-slugs";import { isProductionEnvironment } from "@/lib/sandbox/environment";-import { shouldIndexProgramLander } from "@/lib/sandbox/program-seo";import { DEFAULT_PARTNER_GROUP } from "@/lib/zod/schemas/groups";import { formatRewardDescription } from "@/ui/partners/format-reward-description";import { Wordmark } from "@dub/ui";@@ -52,10 +51,7 @@ export async function generateMetadata(props: {...(isProduction && {canonicalUrl: `${PARTNERS_DOMAIN}/${program.slug}`,}),- noIndex: !shouldIndexProgramLander({- environment: program.environment,- landerPublishedAt,- }),+ noIndex: !(isProduction && Boolean(landerPublishedAt)),});}diff --git a/apps/web/lib/sandbox/program-seo.ts b/apps/web/lib/sandbox/program-seo.tsdeleted file mode 100644index c7bbd9991a..0000000000--- a/apps/web/lib/sandbox/program-seo.ts+++ /dev/null@@ -1,18 +0,0 @@-import { WorkspaceEnvironment } from "@prisma/client";-import { isProductionEnvironment } from "./environment";--/**- * Public program landers should only be indexed when they are published on a- * production program. Staging/sandbox landers stay crawlable for testing but- * must not emit indexable SEO; unpublished landers must not soft-404 with rich- * metadata either.- */-export function shouldIndexProgramLander({- environment,- landerPublishedAt,-}: {- environment: WorkspaceEnvironment | null | undefined;- landerPublishedAt: Date | string | null | undefined;-}) {- return isProductionEnvironment(environment) && Boolean(landerPublishedAt);-}diff --git a/apps/web/tests/misc/program-seo.test.ts b/apps/web/tests/misc/program-seo.test.tsdeleted file mode 100644index 4897193837..0000000000--- a/apps/web/tests/misc/program-seo.test.ts+++ /dev/null@@ -1,37 +0,0 @@-import { shouldIndexProgramLander } from "@/lib/sandbox/program-seo";-import { WorkspaceEnvironment } from "@prisma/client";-import { describe, expect, it } from "vitest";--describe("shouldIndexProgramLander", () => {- it("indexes published production landers only", () => {- expect(- shouldIndexProgramLander({- environment: WorkspaceEnvironment.production,- landerPublishedAt: new Date(),- }),- ).toBe(true);- });-- it("does not index unpublished production landers", () => {- expect(- shouldIndexProgramLander({- environment: WorkspaceEnvironment.production,- landerPublishedAt: null,- }),- ).toBe(false);- });-- it("does not index published staging or sandbox landers", () => {- for (const environment of [- WorkspaceEnvironment.staging,- WorkspaceEnvironment.sandbox,- ]) {- expect(- shouldIndexProgramLander({- environment,- landerPublishedAt: new Date(),- }),- ).toBe(false);- }- });-});