Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fixed generateStaticParams and generateMetadata

Steven Tey2f95ded3c2d5
diff --git a/app/dub.sh/help/article/[slug]/page.tsx b/app/dub.sh/help/article/[slug]/page.tsx
index 8f64ff84c5..b1f01b5745 100644
--- a/app/dub.sh/help/article/[slug]/page.tsx
+++ b/app/dub.sh/help/article/[slug]/page.tsx
@@ -34,7 +34,7 @@ export async function generateMetadata({
const { title, summary } = post;
return constructMetadata({
- title,
+ title: `${title} | Dub Help Center`,
description: summary,
image: `/api/og/help?title=${encodeURIComponent(
title,
diff --git a/app/dub.sh/help/category/[slug]/page.tsx b/app/dub.sh/help/category/[slug]/page.tsx
index af9b156e9c..567a6a8004 100644
--- a/app/dub.sh/help/category/[slug]/page.tsx
+++ b/app/dub.sh/help/category/[slug]/page.tsx
@@ -6,6 +6,35 @@ import SearchButton from "#/ui/content/search-button";
import Link from "next/link";
import { ChevronRight } from "lucide-react";
import ArticleLink from "#/ui/content/article-link";
+import { Metadata } from "next";
+import { constructMetadata } from "#/lib/utils";
+
+export async function generateStaticParams() {
+ return CATEGORIES.map((category) => ({
+ slug: category.slug,
+ }));
+}
+
+export async function generateMetadata({
+ params,
+}: {
+ params: { slug: string };
+}): Promise<Metadata | undefined> {
+ const category = CATEGORIES.find((category) => category.slug === params.slug);
+ if (!category) {
+ return;
+ }
+
+ const { title, description } = category;
+
+ return constructMetadata({
+ title: `${title} | Dub Help Center`,
+ description,
+ image: `/api/og/help?title=${encodeURIComponent(
+ title,
+ )}&summary=${encodeURIComponent(description)}`,
+ });
+}
export default function HelpCategory({
params,
diff --git a/app/sitemap.ts b/app/sitemap.ts
index 39cf8be648..c04e917cf9 100644
--- a/app/sitemap.ts
+++ b/app/sitemap.ts
@@ -12,7 +12,6 @@ export default async function Sitemap() {
const headersList = headers();
let domain = headersList.get("host") as string;
if (isHomeHostname(domain)) domain = "dub.sh";
- console.log(CATEGORIES);
const links = await prisma.link.findMany({
where: {