import { Container } from "@/components/landing/container"; import { FadeIn } from "@/components/landing/fade-in"; import { MdxContent } from "@/components/landing/mdx-content"; // import { PageLinks } from "@/components/landing/page-links"; import { Avatar, AvatarImage } from "@/components/ui/avatar"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { authors } from "@/content/blog/authors"; import type { GetServerSideProps, Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { BLOG_PATH, getContentData, getFilePaths, getPost, getQAContent } from "@/lib/mdx-helper"; import service from "@/lib/http/service"; import { Header, NavBack, TimeP } from "@/components/header"; import { baseTitle, baseURL, keywordsRoot } from "@/lib/metadata"; export const runtime = "nodejs"; type Props = { params: { locale: string, slug: string; title: string; description: string; authorName: string }; searchParams: { [key: string]: string | string[] | undefined }; }; export async function generateMetadata({ params }: Props): Promise { // export async function generateMetadata(ctx: any): Promise { // read route params // const { frontmatter } = await getPost(params.slug); const { serialized, frontmatter, headings } = await getQAContent(params.locale, params.slug); console.log("---generateMetadata---", headings) // const { // serialized, // frontmatter, // headings, // } = ctx if (!frontmatter) { return notFound(); } // const baseUrl = process.env.VERCEL_URL ? "https://jellyai.xyz" : "http://localhost:3000"; const baseUrl = process.env.VERCEL_URL ? process.env.VERCEL_URL : baseURL; const ogUrl = new URL("/og/blog", baseUrl); const author = authors[frontmatter.author]; ogUrl.searchParams.set("title", frontmatter.title ?? ""); // ogUrl.searchParams.set("author", author.name ?? ""); // if (author.image.src) { // ogUrl.searchParams.set("image", new URL(author.image.src, baseUrl).toString()); // } return { // title: { // default: 'JellyAI', // template: `${frontmatter.title} | JellyAI` // }, title: `${frontmatter.title}`, description: frontmatter.description, category: `${headings.text}`, keywords: keywordsRoot(headings.text || ""), openGraph: { title: `${frontmatter.title} | ${baseTitle}`, description: frontmatter.description, // url: `https://unkey.dev/blog/${params.slug}`, type: "article", images: [ { url: ogUrl.toString(), width: 1200, height: 630, alt: frontmatter.title, }, ], // siteName: "unkey.dev", }, twitter: { card: "summary_large_image", title: `${frontmatter.title} | ${baseTitle}`, description: frontmatter.description, images: [ { url: ogUrl.toString(), width: 1200, height: 630, alt: frontmatter.title, }, ], // site: "@aigxion", // creator: "@aigxion", }, icons: { shortcut: "/favicon.png", }, }; } const BlogArticleWrapper = async ({ params }: { params: { slug: string, locale: string, } }) => { // const BlogArticleWrapper = async (ctx: any) => { // console.log(ctx) // const { // serialized, // frontmatter, // headings, // } = ctx const { serialized, frontmatter, headings } = await getQAContent(params.locale, params.slug); // console.log(serialized, frontmatter, headings, params.slug) // console.log(params.slug) console.log("frontmatter", frontmatter) return ( <>
{/*

{frontmatter.date}

JellyAI
*/}

{frontmatter.title}

); }; export default BlogArticleWrapper; // const BlogArticleWrapper_bak = async ({ params }: { params: { slug: string } }) => { // const { serialized, frontmatter, headings } = await getPost(params.slug); // console.log(serialized, frontmatter, headings, params.slug) // const author = authors[frontmatter.author]; // const moreArticles = await getContentData({ // contentPath: BLOG_PATH, // filepath: params.slug, // }); // return ( // <> // //
//
//

// {frontmatter.title} //

//

{frontmatter.description}

//
// //
//
//
//
// // // //
//
{author.name}
//
//
// { //
//

// Table of Contents //

// //
// {headings.map((heading) => { // return ( // // ); // })} //
// //
//
// } //
//
//
// //
//
// //
//

// Accelerate your API development //

//
// // Get started // // // Documentation // //
//
//
// App screenshot //
//
//
//
// {/* {moreArticles.length > 0 && ( // // )} */} // // ); // };