seo: sitemap, robots, og tags
This commit is contained in:
@@ -1,13 +1,39 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getPattern, getQuestions } from "@/lib/api";
|
||||
import { QuestionCard } from "@/components/questions/question-card";
|
||||
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export default async function PatternDetailPage({
|
||||
params,
|
||||
}: {
|
||||
interface PageProps {
|
||||
params: Promise<{ slug: string }>;
|
||||
}) {
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
|
||||
try {
|
||||
const pattern = await getPattern(slug);
|
||||
const description =
|
||||
pattern.description ||
|
||||
`Learn the ${pattern.name} pattern with ${pattern.question_count} practice problems.`;
|
||||
|
||||
return {
|
||||
title: `${pattern.name} Pattern`,
|
||||
description,
|
||||
openGraph: {
|
||||
title: `${pattern.name} Pattern | CodeTutor`,
|
||||
description,
|
||||
type: "article",
|
||||
},
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
title: "Pattern Not Found",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default async function PatternDetailPage({ params }: PageProps) {
|
||||
const { slug } = await params;
|
||||
|
||||
let pattern;
|
||||
|
||||
Reference in New Issue
Block a user