Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

1.3 KB
Raw Blame
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { GuidePage } from "@/components/landing/guide-page";
import { guideList, guidePath, guides } from "@/lib/guides";

type Params = { slug: string };

export function generateStaticParams(): Params[] {
  return guideList.map((guide) => ({ slug: guide.slug }));
}

export async function generateMetadata({
  params,
}: {
  params: Promise<Params>;
}): Promise<Metadata> {
  const { slug } = await params;
  const data = guides[slug];
  if (!data) return {};

  return {
    title: data.title,
    description: data.description,
    alternates: { canonical: guidePath(data.slug) },
    openGraph: {
      type: "article",
      siteName: "Kaneo",
      images: ["/images/hero.png"],
      title: `${data.title} | Kaneo`,
      description: data.description,
      url: `https://kaneo.app${guidePath(data.slug)}`,
    },
    twitter: {
      card: "summary_large_image",
      title: `${data.title} | Kaneo`,
      description: data.description,
      images: ["/images/hero.png"],
    },
  };
}

export default async function Page({ params }: { params: Promise<Params> }) {
  const { slug } = await params;
  const data = guides[slug];
  if (!data) notFound();

  return <GuidePage data={data} />;
}