The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Fixed intercepting routes
Steven Teya7efa7c1e1dc
diff --git a/app/(marketing)/changelog/[slug]/page.tsx b/app/(marketing)/changelog/[slug]/page.tsxdeleted file mode 100644index 1dba518625..0000000000--- a/app/(marketing)/changelog/[slug]/page.tsx+++ /dev/null@@ -1,157 +0,0 @@-import type { Metadata } from "next";-import { notFound } from "next/navigation";-import { allChangelogPosts } from "contentlayer/generated";-import { MDX } from "#/ui/blog/mdx";-import Link from "next/link";-import { formatDate } from "@/lib/utils";-import { getBlurDataURL } from "@/lib/images";-import BlurImage from "#/ui/blur-image";-import Author from "#/ui/blog/author";-import { Facebook, LinkedIn, Twitter } from "@/components/shared/icons";--export const runtime = "edge";--export async function generateStaticParams() {- return allChangelogPosts.map((post) => ({- slug: post.slug,- }));-}--export async function generateMetadata({- params,-}: {- params: { slug: string };-}): Promise<Metadata | undefined> {- const post = allChangelogPosts.find((post) => post.slug === params.slug);- if (!post) {- return;- }-- const {- title,- publishedAt: publishedTime,- summary: description,- image,- slug,- } = post;-- return {- title: `${title} - Dub Changelog`,- description,- openGraph: {- title: `${title} - Dub Changelog`,- description,- type: "article",- publishedTime,- url: `https://dub.sh/changelog/${slug}`,- images: [- {- url: image,- },- ],- },- twitter: {- card: "summary_large_image",- title,- description,- images: [image],- },- };-}--export default async function ChangelogPost({- params,-}: {- params: { slug: string };-}) {- const post = allChangelogPosts.find((post) => post.slug === params.slug);- if (!post) {- notFound();- }-- return (- <div className="mx-auto my-20 grid max-w-screen-xl md:grid-cols-4 md:px-20">- <div className="sticky top-10 hidden self-start md:col-span-1 md:block">- <Link- href="/changelog"- className="text-sm text-gray-500 transition-colors hover:text-gray-800"- >- ← Back to Changelog- </Link>- </div>- <div className="flex flex-col space-y-8 md:col-span-3">- <div className="mx-5 grid gap-5 md:mx-0">- <div className="flex flex-col">- <Link- href="/changelog"- className="my-5 text-sm text-gray-500 md:hidden"- >- ← Back to Changelog- </Link>- <time- dateTime={post.publishedAt}- className="flex items-center text-sm text-gray-500 md:text-base"- >- {formatDate(post.publishedAt)}- </time>- </div>- <h1 className="font-display text-3xl font-bold tracking-tight text-gray-800 sm:text-4xl">- {post.title}- </h1>- </div>- <BlurImage- src={post.image}- alt={post.title}- width={1200}- height={900}- priority // since it's above the fold- placeholder="blur"- blurDataURL={await getBlurDataURL(post.image!)}- className="border border-gray-100 md:rounded-2xl"- />- <div className="mx-5 mb-10 flex items-center justify-between md:mx-0">- {/* @ts-expect-error Async Server Component */}- <Author username={post.author} />- <div className="flex items-center space-x-6">- <Link- href={`https://twitter.com/intent/tweet?text=${post.title}&url=https://dub.sh/changelog/${post.slug}&via=${post.author}`}- target="_blank"- rel="noopener noreferrer"- className="transition-all hover:scale-110"- >- <Twitter className="h-6 w-6" />- </Link>- <Link- href={`- http://www.linkedin.com/shareArticle?mini=true&url=https://dub.sh/changelog/${post.slug}`}- target="_blank"- rel="noopener noreferrer"- className="transition-all hover:scale-110"- >- <LinkedIn className="h-6 w-6" fill="black" />- </Link>- <Link- href={`https://www.facebook.com/sharer/sharer.php?u=https://dub.sh/changelog/${post.slug}`}- target="_blank"- rel="noopener noreferrer"- className="transition-all hover:scale-110"- >- <Facebook className="h-6 w-6" fill="black" />- </Link>- </div>- </div>- <MDX code={post.body.code} />- <div className="mt-10 flex justify-end border-t border-gray-200 pt-5">- <Link- href={`https://github.com/steven-tey/dub/blob/main/posts/changelog/${params.slug}.mdx`}- target="_blank"- rel="noopener noreferrer"- className="text-sm text-gray-500 transition-colors hover:text-gray-800"- >- <p>Found a typo? Edit this page →</p>- </Link>- </div>- </div>- </div>- );-}diff --git a/app/(marketing)/changelog/page.tsx b/app/(marketing)/changelog/page.tsxdeleted file mode 100644index 197cf9a2f7..0000000000--- a/app/(marketing)/changelog/page.tsx+++ /dev/null@@ -1,116 +0,0 @@-import BlurImage from "#/ui/blur-image";-import { getBlurDataURL } from "@/lib/images";-import { allChangelogPosts } from "contentlayer/generated";-import { Metadata } from "next";-import { formatDate } from "@/lib/utils";-import Link from "next/link";-import { MDX } from "#/ui/blog/mdx";-import { Twitter } from "@/components/shared/icons";-import { Rss } from "lucide-react";--export const runtime = "edge";--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.",-};--export default async function Changelog() {- return (- <div className="mx-auto max-w-screen-xl md:px-20">- <div className="relative grid border-b border-gray-200 py-20 md:grid-cols-4">- <div className="md:col-span-1" />- <div className="mx-5 flex flex-col space-y-6 md:col-span-3 md:mx-0">- <h1 className="font-display text-4xl font-bold tracking-tight text-gray-800 md:text-5xl">- Changelog- </h1>- <p className="text-lg text-gray-500">- All the latest updates, improvements, and fixes to Dub.- </p>- </div>- <div className="absolute bottom-2 right-0 flex items-center space-x-2">- <p className="text-sm text-gray-500">Subscribe to updates →</p>- <Link- href="https://twitter.com/dubdotsh"- className="rounded-full bg-blue-100 p-2 transition-colors hover:bg-blue-200"- target="_blank"- rel="noopener noreferrer"- >- <Twitter className="h-4 w-4 text-[#1d9bf0]" />- </Link>- <Link- href="/atom"- className="rounded-full bg-gray-100 p-2 transition-colors hover:bg-gray-200"- >- <Rss className="h-4 w-4 text-gray-500" />- </Link>- </div>- </div>-- <div className="divide-y divide-gray-200">- {/* @ts-expect-error Async Server Component */}- {allChangelogPosts- .sort((a, b) => {- if (new Date(a.publishedAt) > new Date(b.publishedAt)) {- return -1;- }- return 1;- })- .map(async (post, idx) => (- <div- key={idx}- className="grid py-20 md:grid-cols-4 md:px-5 xl:px-0"- >- <div className="sticky top-10 hidden self-start md:col-span-1 md:block">- <Link href={`/changelog/${post.slug}`}>- <time- dateTime={post.publishedAt}- className="text-gray-500 transition-colors hover:text-gray-800"- >- {formatDate(post.publishedAt)}- </time>- </Link>- </div>- <div className="md:col-span-3">- <div className="flex flex-col gap-6">- <Link href={`/changelog/${post.slug}`}>- <BlurImage- src={post.image}- alt={post.title}- width={1200}- height={900}- priority={idx === 0} // since it's above the fold- placeholder="blur"- blurDataURL={await getBlurDataURL(post.image!)}- className="border border-gray-100 md:rounded-2xl"- />- </Link>- <Link- href={`/changelog/${post.slug}`}- className="group mx-5 flex items-center space-x-3 md:mx-0"- >- <time- dateTime={post.publishedAt}- className="text-sm text-gray-500 transition-all group-hover:text-gray-800 md:hidden"- >- {formatDate(post.publishedAt)}- </time>- </Link>- <Link- href={`/changelog/${post.slug}`}- className="mx-5 md:mx-0"- >- <h2 className="font-display text-3xl font-bold tracking-tight text-gray-800 hover:underline hover:decoration-1 hover:underline-offset-4 md:text-4xl">- {post.title}- </h2>- </Link>- <MDX code={post.body.code} />- </div>- </div>- </div>- ))}- </div>- </div>- );-}diff --git a/app/dub.sh/@modal/(...)stats/[key]/default.tsx b/app/dub.sh/@modal/(.)stats/[key]/default.tsxsimilarity index 100%rename from app/dub.sh/@modal/(...)stats/[key]/default.tsxrename to app/dub.sh/@modal/(.)stats/[key]/default.tsxdiff --git a/app/dub.sh/@modal/(...)stats/[key]/page.tsx b/app/dub.sh/@modal/(.)stats/[key]/page.tsxsimilarity index 100%rename from app/dub.sh/@modal/(...)stats/[key]/page.tsxrename to app/dub.sh/@modal/(.)stats/[key]/page.tsxdiff --git a/app/dub.sh/layout.tsx b/app/dub.sh/layout.tsxindex 38a5f67095..2973765ab1 100644--- a/app/dub.sh/layout.tsx+++ b/app/dub.sh/layout.tsx@@ -5,7 +5,7 @@ export default function MarketingLayout(props) {return (<div className="flex min-h-screen flex-col justify-between">{/* Only show stats modal if not on the /stats page */}- {props.children.props.childProp.segment !== "stats" && props.modal}+ {props.modal}<Nav />{props.children}<Footer />diff --git a/middleware.ts b/middleware.tsindex abda9c4545..f8c010a984 100644--- a/middleware.ts+++ b/middleware.ts@@ -7,7 +7,7 @@ import {RootMiddleware,} from "@/lib/middleware";import { parse } from "@/lib/middleware/utils";-import { isHomeHostname, isReservedKey } from "./lib/utils";+import { isReservedKey } from "./lib/utils";export const config = {matcher: [@@ -18,9 +18,9 @@ export const config = {* 3. /_proxy/, /_auth/ (special pages for OG tags proxying and password protection)* 4. /_static (inside /public)* 5. /_vercel (Vercel internals)- * 6. all root files inside /public (e.g. /favicon.ico)+ * 6. /favicon.ico, /sitemap.xml (static files)*/- "/((?!api/|_next/|_proxy/|_auth/|_static|_vercel|favicon.ico).*)",+ "/((?!api/|_next/|_proxy/|_auth/|_static|_vercel|favicon.ico|sitemap.xml).*)",],};