Skip to content

An open source design system that's fully customizable and agent ready

TypeScript
610 B
Raw Blame
// Copyright (c) Meta Platforms, Inc. and affiliates.

/**
 * Redirect /templates/<slug> to /templates?preview=<slug> so the preview
 * dialog opens on the gallery page. Keeps old direct links working.
 */

import {redirect} from 'next/navigation';
import {templateMetadata as templates} from '../../../../generated/templateMetadataRegistry';

export function generateStaticParams() {
  return templates.map(t => ({slug: t.slug}));
}

export default async function TemplatePage({
  params,
}: {
  params: Promise<{slug: string}>;
}) {
  const {slug} = await params;
  redirect(`/templates?preview=${slug}`);
}