import React from "react"; import { auth } from "@/auth"; import { redirect } from "next/navigation"; import CreatePostForm from "@/components/CreatePostForm"; import type { Metadata } from "next"; // Metadata for the page, preventing search engine indexing export const metadata: Metadata = { title: "Create New TechTalk Post | OMS", description: "Create a new blog post for OMS TechTalk.", robots: { index: false, follow: false }, // Don't index the creation page }; // Page component to render the creation form export default async function CreateTechTalkPage() { const session = await auth(); // Protect the route: Redirect if not logged in if (!session?.user) { // Redirect to sign-in page, passing the current page as callbackUrl // This ensures the user returns here after successful login const callbackUrl = encodeURIComponent("/tech-talk/create"); redirect(`/api/auth/signin?callbackUrl=${callbackUrl}`); } // Render the page content if the user is authenticated return (