diff --git a/apps/web/src/app/(admin)/backoffice/layout.tsx b/apps/web/src/app/(admin)/backoffice/layout.tsx index b4c718f71..9505efff6 100644 --- a/apps/web/src/app/(admin)/backoffice/layout.tsx +++ b/apps/web/src/app/(admin)/backoffice/layout.tsx @@ -1,7 +1,6 @@ import { ReactNode } from 'react' import { SessionProvider } from '@latitude-data/web-ui' -import buildMetatags from '$/app/_lib/buildMetatags' import { getCurrentUser } from '$/services/auth/getCurrentUser' import { getSession } from '$/services/auth/getSession' import { ROUTES } from '$/services/routes' @@ -9,10 +8,6 @@ import { redirect } from 'next/navigation' import { BackofficeTabs } from './_components/BackofficeTabs' -export const metadata = buildMetatags({ - title: 'Backoffice', -}) - export default async function AdminLayout({ children, }: { diff --git a/apps/web/src/app/(private)/dashboard/layout.tsx b/apps/web/src/app/(private)/dashboard/layout.tsx index 6d8c01a16..a51140766 100644 --- a/apps/web/src/app/(private)/dashboard/layout.tsx +++ b/apps/web/src/app/(private)/dashboard/layout.tsx @@ -5,7 +5,6 @@ import { TableBlankSlate, TableWithHeader, } from '@latitude-data/web-ui' -import buildMetatags from '$/app/_lib/buildMetatags' import { AppTabs } from '$/app/(private)/AppTabs' import { getCurrentUser } from '$/services/auth/getCurrentUser' import { ROUTES } from '$/services/routes' @@ -14,10 +13,6 @@ import Link from 'next/link' import { getActiveProjectsCached } from '../_data-access' import { ProjectsTable } from './_components/ProjectsTable' -export const metadata = buildMetatags({ - title: 'Dashboard', -}) - export default async function DashboardLayout({ children, }: Readonly<{ diff --git a/apps/web/src/app/(private)/datasets/layout.tsx b/apps/web/src/app/(private)/datasets/layout.tsx index f3dcb5ee2..70dc6ba7c 100644 --- a/apps/web/src/app/(private)/datasets/layout.tsx +++ b/apps/web/src/app/(private)/datasets/layout.tsx @@ -2,17 +2,12 @@ import { ReactNode } from 'react' import { DatasetsRepository } from '@latitude-data/core/repositories' import { Container, TableWithHeader } from '@latitude-data/web-ui' -import buildMetatags from '$/app/_lib/buildMetatags' import { AppTabs } from '$/app/(private)/AppTabs' import { DatasetsTable } from '$/app/(private)/datasets/_components/DatasetsTable' import { getCurrentUser } from '$/services/auth/getCurrentUser' import { ROUTES } from '$/services/routes' import Link from 'next/link' -export const metadata = buildMetatags({ - title: 'Datasets', -}) - export default async function DatasetsList({ children, }: Readonly<{ diff --git a/apps/web/src/app/(private)/datasets/preview/[datasetId]/page.tsx b/apps/web/src/app/(private)/datasets/preview/[datasetId]/page.tsx index 00c7afe36..4ef1ecf94 100644 --- a/apps/web/src/app/(private)/datasets/preview/[datasetId]/page.tsx +++ b/apps/web/src/app/(private)/datasets/preview/[datasetId]/page.tsx @@ -1,34 +1,7 @@ -import { NotFoundError } from '@latitude-data/core/lib/errors' -import buildMetatags from '$/app/_lib/buildMetatags' import { getDatasetCached } from '$/app/(private)/_data-access' -import type { ResolvingMetadata } from 'next' -import { notFound } from 'next/navigation' import PreviewDatasetModal from './_components/PreviewDatasetModal' -export async function generateMetadata( - { - params, - }: { - params: Promise<{ datasetId: string }> - }, - parent: ResolvingMetadata, -) { - const { datasetId } = await params - - try { - const dataset = await getDatasetCached(datasetId) - - return buildMetatags({ - title: `${dataset.name} (preview)`, - parent: await parent, - }) - } catch (error) { - if (error instanceof NotFoundError) return notFound() - throw error - } -} - export default async function DatasetPreviewPage({ params, }: { diff --git a/apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/layout.tsx b/apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/layout.tsx deleted file mode 100644 index 5abf3f689..000000000 --- a/apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/layout.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { ReactNode } from 'react' - -import { NotFoundError } from '@latitude-data/core/lib/errors' -import buildMetatags from '$/app/_lib/buildMetatags' -import { getEvaluationByUuidCached } from '$/app/(private)/_data-access' -import type { ResolvingMetadata } from 'next' -import { notFound } from 'next/navigation' - -export async function generateMetadata( - { - params, - }: { - params: Promise<{ evaluationUuid: string }> - }, - parent: ResolvingMetadata, -) { - const { evaluationUuid } = await params - - try { - const evaluation = await getEvaluationByUuidCached(evaluationUuid) - - return buildMetatags({ - title: evaluation.name, - parent: await parent, - }) - } catch (error) { - if (error instanceof NotFoundError) return notFound() - throw error - } -} - -export default async function EvaluationLayout({ - children, -}: Readonly<{ - children: ReactNode -}>) { - return <>{children} -} diff --git a/apps/web/src/app/(private)/evaluations/layout.tsx b/apps/web/src/app/(private)/evaluations/layout.tsx deleted file mode 100644 index 71b3ab65f..000000000 --- a/apps/web/src/app/(private)/evaluations/layout.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { ReactNode } from 'react' - -import buildMetatags from '$/app/_lib/buildMetatags' - -export const metadata = buildMetatags({ - title: 'Evaluations', -}) - -export default async function EvaluationsLayout({ - children, -}: Readonly<{ - children: ReactNode -}>) { - return <>{children} -} diff --git a/apps/web/src/app/(private)/layout.tsx b/apps/web/src/app/(private)/layout.tsx index 71d5e1250..4f78d644c 100644 --- a/apps/web/src/app/(private)/layout.tsx +++ b/apps/web/src/app/(private)/layout.tsx @@ -1,7 +1,6 @@ import { ReactNode } from 'react' import { SessionProvider } from '@latitude-data/web-ui/browser' -import buildMetatags from '$/app/_lib/buildMetatags' import { createSupportUserIdentity } from '$/app/(private)/_lib/createSupportUserIdentity' import { SupportChat } from '$/components/IntercomSupportChat' import { AppLayout } from '$/components/layouts' @@ -18,10 +17,6 @@ import { redirect } from 'next/navigation' import { CSPostHogProvider, IdentifyUser } from '../providers' import { NAV_LINKS } from './_lib/constants' -export const metadata = buildMetatags({ - title: 'Home', -}) - export default async function PrivateLayout({ children, }: Readonly<{ diff --git a/apps/web/src/app/(private)/projects/[projectId]/layout.tsx b/apps/web/src/app/(private)/projects/[projectId]/layout.tsx deleted file mode 100644 index a7f7ddcf9..000000000 --- a/apps/web/src/app/(private)/projects/[projectId]/layout.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { ReactNode } from 'react' - -import { NotFoundError } from '@latitude-data/core/lib/errors' -import buildMetatags from '$/app/_lib/buildMetatags' -import { findProjectCached } from '$/app/(private)/_data-access' -import { getCurrentUser } from '$/services/auth/getCurrentUser' -import type { ResolvingMetadata } from 'next' -import { notFound } from 'next/navigation' - -export async function generateMetadata( - { - params, - }: { - params: Promise<{ projectId: string }> - }, - parent: ResolvingMetadata, -) { - const { projectId } = await params - - try { - const session = await getCurrentUser() - const project = await findProjectCached({ - projectId: Number(projectId), - workspaceId: session.workspace.id, - }) - - return buildMetatags({ - title: project.name, - parent: await parent, - }) - } catch (error) { - if (error instanceof NotFoundError) return notFound() - throw error - } -} - -export default async function ProjectLayout({ - children, -}: Readonly<{ - children: ReactNode -}>) { - return <>{children} -} diff --git a/apps/web/src/app/(private)/projects/layout.tsx b/apps/web/src/app/(private)/projects/layout.tsx deleted file mode 100644 index c447724c2..000000000 --- a/apps/web/src/app/(private)/projects/layout.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { ReactNode } from 'react' - -import buildMetatags from '$/app/_lib/buildMetatags' - -export const metadata = buildMetatags({ - title: 'Projects', -}) - -export default async function ProjectsLayout({ - children, -}: Readonly<{ - children: ReactNode -}>) { - return <>{children} -} diff --git a/apps/web/src/app/(private)/settings/layout.tsx b/apps/web/src/app/(private)/settings/layout.tsx index 1b3cfcee9..0a24da804 100644 --- a/apps/web/src/app/(private)/settings/layout.tsx +++ b/apps/web/src/app/(private)/settings/layout.tsx @@ -1,7 +1,6 @@ import { ReactNode } from 'react' import { Container, TitleWithActions } from '@latitude-data/web-ui' -import buildMetatags from '$/app/_lib/buildMetatags' import { AppTabs } from '$/app/(private)/AppTabs' import Memberships from './_components/Memberships' @@ -9,10 +8,6 @@ import ProviderApiKeys from './_components/ProviderApiKeys' import WorkspaceApiKeys from './_components/WorkspaceApiKeys' import WorkspaceName from './_components/WorkspaceName' -export const metadata = buildMetatags({ - title: 'Settings', -}) - export default async function SettingsLayout({ children, }: Readonly<{ diff --git a/apps/web/src/app/(public)/invitations/[token]/page.tsx b/apps/web/src/app/(public)/invitations/[token]/page.tsx index 282634149..728be3152 100644 --- a/apps/web/src/app/(public)/invitations/[token]/page.tsx +++ b/apps/web/src/app/(public)/invitations/[token]/page.tsx @@ -1,6 +1,5 @@ import { NotFoundError } from '@latitude-data/core/lib/errors' import { Card, CardContent, FocusHeader } from '@latitude-data/web-ui' -import buildMetatags from '$/app/_lib/buildMetatags' import { FocusLayout } from '$/components/layouts' import { ROUTES } from '$/services/routes' import { redirect } from 'next/navigation' @@ -15,10 +14,6 @@ import InvitationForm from './InvitationForm' export const dynamic = 'force-dynamic' -export const metadata = buildMetatags({ - title: 'You have been invited to join a workspace', -}) - export default async function InvitationPage({ params, }: { diff --git a/apps/web/src/app/(public)/login/page.tsx b/apps/web/src/app/(public)/login/page.tsx index d05ad7d27..ba4bd8e32 100644 --- a/apps/web/src/app/(public)/login/page.tsx +++ b/apps/web/src/app/(public)/login/page.tsx @@ -1,5 +1,4 @@ import { Card, CardContent, FocusHeader } from '@latitude-data/web-ui' -import buildMetatags from '$/app/_lib/buildMetatags' import AuthFooter from '$/app/(public)/_components/Footer' import LoginFooter from '$/app/(public)/login/_components/LoginFooter' import { FocusLayout } from '$/components/layouts' @@ -11,10 +10,6 @@ import LoginForm from './LoginForm' export const dynamic = 'force-dynamic' -export const metadata = buildMetatags({ - title: 'Login to your account', -}) - export default async function LoginPage() { const data = await getSession() if (data.session) return redirect(ROUTES.dashboard.root) diff --git a/apps/web/src/app/(public)/magic-links/sent/page.tsx b/apps/web/src/app/(public)/magic-links/sent/page.tsx index a82e87fb3..b0738f980 100644 --- a/apps/web/src/app/(public)/magic-links/sent/page.tsx +++ b/apps/web/src/app/(public)/magic-links/sent/page.tsx @@ -1,13 +1,8 @@ import { FocusHeader } from '@latitude-data/web-ui' -import buildMetatags from '$/app/_lib/buildMetatags' import { FocusLayout } from '$/components/layouts' import { ROUTES } from '$/services/routes' import { redirect } from 'next/navigation' -export const metadata = buildMetatags({ - title: 'Login to your account', -}) - export default async function MagicLinkSent({ searchParams, }: { diff --git a/apps/web/src/app/(public)/setup/page.tsx b/apps/web/src/app/(public)/setup/page.tsx index 5fc0f4824..f0efba050 100644 --- a/apps/web/src/app/(public)/setup/page.tsx +++ b/apps/web/src/app/(public)/setup/page.tsx @@ -1,5 +1,4 @@ import { Card, CardContent, FocusHeader } from '@latitude-data/web-ui' -import buildMetatags from '$/app/_lib/buildMetatags' import AuthFooter from '$/app/(public)/_components/Footer' import { FocusLayout } from '$/components/layouts' @@ -7,10 +6,6 @@ import SetupForm from './SetupForm' export const dynamic = 'force-dynamic' -export const metadata = buildMetatags({ - title: 'Create an account', -}) - export default async function SetupPage({ searchParams, }: { diff --git a/apps/web/src/app/_lib/buildMetatags.ts b/apps/web/src/app/_lib/buildMetatags.ts deleted file mode 100644 index c482b743a..000000000 --- a/apps/web/src/app/_lib/buildMetatags.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { env } from '@latitude-data/env' -import type { Metadata, ResolvedMetadata } from 'next' - -const DEFAULT_TITLE = 'The Open-Source LLM Development Platform' -const DEFAULT_DESCRIPTION = - 'Latitude is an end-to-end platform for prompt engineering where domain experts can collaborate with engineers to ship and maintain production-grade LLM features.' - -// This function is necessary to define default metadata correctly, because -// Nextjs metadata merging would overwrite the nested objects totally. -export default function buildMetatags({ - title, - description, - parent, -}: { - title?: string - description?: string - parent?: ResolvedMetadata -}): Metadata { - let parentTitle = parent?.title?.absolute || '' - let metaTitle = - title && parentTitle - ? `${title} - ${parentTitle}` - : title || parentTitle || DEFAULT_TITLE - if (!metaTitle.endsWith(' - Latitude')) metaTitle += ' - Latitude' - - const metaDescription = description || DEFAULT_DESCRIPTION - - return { - metadataBase: new URL(env.LATITUDE_URL), - title: metaTitle, - description: metaDescription, - openGraph: { - // Note, og:url is not set because there is no way to get - // the current url in server components, other than hacks - // like getting it from the HTTP headers... - type: 'website', - siteName: 'Latitude', - title: metaTitle, - description: metaDescription, - }, - twitter: { - card: 'summary', - title: metaTitle, - description: metaDescription, - }, - } -} diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index 0fdb1ceac..08912ff66 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -1,6 +1,6 @@ import { ReactNode } from 'react' -import buildMetatags from '$/app/_lib/buildMetatags' +import type { Metadata } from 'next' import NextTopLoader from 'nextjs-toploader' import '@latitude-data/web-ui/styles.css' @@ -12,9 +12,10 @@ import { } from '@latitude-data/web-ui' import { fontMono, fontSans } from '$/helpers/fonts' -export const metadata = buildMetatags({ - title: 'The Open-Source LLM Development Platform', -}) +export const metadata: Metadata = { + title: 'Latitude App', + description: 'LLM - Latitude App', +} export default function RootLayout({ children, diff --git a/apps/web/src/app/not-found.tsx b/apps/web/src/app/not-found.tsx index 3afa7befc..27c9ad043 100644 --- a/apps/web/src/app/not-found.tsx +++ b/apps/web/src/app/not-found.tsx @@ -1,13 +1,8 @@ import { Button } from '@latitude-data/web-ui' import { ErrorComponent } from '@latitude-data/web-ui/browser' -import buildMetatags from '$/app/_lib/buildMetatags' import { ROUTES } from '$/services/routes' import Link from 'next/link' -export const metadata = buildMetatags({ - title: 'Not found', -}) - export default async function GlobalNoFound() { return (