The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
modularize <Meta /> component
Steven Teyd505b67df248
diff --git a/components/layout/meta.tsx b/components/layout/meta.tsxindex 12144bf757..de56f9b006 100644--- a/components/layout/meta.tsx+++ b/components/layout/meta.tsx@@ -1,14 +1,19 @@import Head from "next/head";import { FAVICON_FOLDER } from "@/lib/constants";-export default function Meta() {+export default function Meta({+ title = "Dub - Open-Source Bitly Alternative",+ description = "An open-source link shortener SaaS with built-in analytics and free custom domains.",+ image = "https://dub.sh/_static/thumbnail.png",+}: {+ title?: string;+ description?: string;+ image?: string;+}) {return (<Head>- <title>Dub - Open-Source Bitly Alternative</title>- <meta- name="description"- content="An open-source link shortener SaaS with built-in analytics and free custom domains."- />+ <title>{title}</title>+ <meta name="description" content={description} /><linkrel="apple-touch-icon"sizes="180x180"@@ -37,12 +42,9 @@ export default function Meta() {<meta charSet="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />- <meta itemProp="image" content="https://dub.sh/_static/thumbnail.png" />+ <meta itemProp="image" content={image} /><meta property="og:logo" content="https://dub.sh/_static/logo.png"></meta>- <meta- property="og:image"- content="https://dub.sh/_static/thumbnail.png"- />+ <meta property="og:image" content={image} /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:site" content="@dubdotsh" />@@ -51,14 +53,8 @@ export default function Meta() {name="twitter:title"content="Dub - Open-Source Bitly Alternative"/>- <meta- name="twitter:description"- content="An open-source link shortener SaaS with built-in analytics and free custom domains."- />- <meta- name="twitter:image"- content="https://dub.sh/_static/thumbnail.png"- />+ <meta name="twitter:description" content={description} />+ <meta name="twitter:image" content={image} /></Head>);}diff --git a/pages/app/[slug]/index.tsx b/pages/app/[slug]/index.tsxindex 3f6f9525b2..441099b9ad 100644--- a/pages/app/[slug]/index.tsx+++ b/pages/app/[slug]/index.tsx@@ -21,10 +21,10 @@ export default function ProjectLinks() {useEffect(() => {if (error && (error.status === 409 || error.status === 410)) {setShowAcceptInviteModal(true);- } else if (!project.domainVerified) {+ } else if (project && !project.domainVerified) {setShowCompleteSetupModal(true);}- }, [error, project.domainVerified]);+ }, [error, project]);if (error && error.status === 404) {return <ErrorPage statusCode={404} />;@@ -33,7 +33,7 @@ export default function ProjectLinks() {return (<AppLayout>{project && <AddEditLinkModal />}- {!project.domainVerified && <CompleteSetupModal />}+ {!project?.domainVerified && <CompleteSetupModal />}{error && (error.status === 409 || error.status === 410) && (<AcceptInviteModal />)}diff --git a/pages/app/login.tsx b/pages/app/login.tsxindex 39ef41222c..f03349cd86 100644--- a/pages/app/login.tsx+++ b/pages/app/login.tsx@@ -14,7 +14,7 @@ export default function Login() {return (<div className="flex h-screen w-screen items-center justify-center bg-gray-50">- <Meta />+ <Meta title="Sign in to Dub" /><Background /><div className="z-10 w-full max-w-md overflow-hidden rounded-2xl border border-gray-100 shadow-xl"><div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 bg-white px-4 py-6 pt-8 text-center sm:px-16">diff --git a/pages/app/register.tsx b/pages/app/register.tsxindex ebc8305649..9a1dd2c678 100644--- a/pages/app/register.tsx+++ b/pages/app/register.tsx@@ -14,7 +14,7 @@ export default function Login() {return (<div className="flex h-screen w-screen items-center justify-center bg-gray-50">- <Meta />+ <Meta title="Sign up for Dub" /><Background /><div className="z-10 w-full max-w-md overflow-hidden rounded-2xl border border-gray-100 shadow-xl"><div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 bg-white px-4 py-6 pt-8 text-center sm:px-16">diff --git a/pages/app/welcome.tsx b/pages/app/welcome.tsxindex 0db7e56cd8..51287d3a1c 100644--- a/pages/app/welcome.tsx+++ b/pages/app/welcome.tsx@@ -5,6 +5,7 @@ import { AnimatePresence } from "framer-motion";import { useEffect, useState } from "react";import { useAddProjectModal } from "@/components/app/modals/add-project-modal";import { useAddEditLinkModal } from "@/components/app/modals/add-edit-link-modal";+import Meta from "@/components/layout/meta";const staggerChildVariants = {hidden: { opacity: 0, y: 20 },@@ -36,6 +37,7 @@ export default function Welcome() {return (<div className="flex h-screen flex-col items-center">+ <Meta title="Welcome to Dub" /><Background /><AddProjectModal /><AddEditLinkModal />