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, getPostContent } from "@/lib/mdx-helper"; import service from "@/lib/http/service"; import { Header, NavBack, TimeP } from "@/components/header"; import { baseTitle, baseURL, keywordsRoot } from "@/lib/metadata"; import { useTranslation } from "react-i18next"; import { DetailPageHeader } from '@/components/header' 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 { const { serialized, frontmatter, headings } = await getPostContent(params.locale, params.slug); console.log("2--------------------------generateMetadata-----------------------------", headings) if (!frontmatter) { return notFound(); } 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 ?? ""); return { title: `${frontmatter.title}`, description: frontmatter.description, keywords: keywordsRoot(headings.text || ""), openGraph: { title: `${frontmatter.title} | ${baseTitle}`, description: frontmatter.description, type: "article", images: [ { url: ogUrl.toString(), width: 1200, height: 630, alt: frontmatter.title, }, ], }, twitter: { card: "summary_large_image", title: `${frontmatter.title} | ${baseTitle}`, description: frontmatter.description, images: [ { url: ogUrl.toString(), width: 1200, height: 630, alt: frontmatter.title, }, ], }, icons: { shortcut: "/favicon.png", }, }; } const BlogArticleWrapper = async ({ params }: { params: { slug: string, locale: string, } }) => { const { serialized, frontmatter, headings } = await getPostContent(params.locale, params.slug); console.log("..........................frontmatter", frontmatter) const defaultImage = "https://gimg3.baidu.com/search/src=http%3A%2F%2Fpics3.baidu.com%2Ffeed%2F4ec2d5628535e5dd7c7cdc23847e08e2cc1b62c4.jpeg%40f_auto%3Ftoken%3D38327d5cbefb2cd45af58f8d47c0a0b5&refer=http%3A%2F%2Fwww.baidu.com&app=2021&size=f360,240&n=0&g=0n&q=75&fmt=auto?sec=1710435600&t=eafc0a27ff3295bb5b0b9065fc33a523" // // 请求部署状态 let statusText = ''; let progress = '0%'; // let data: any; // try { // data = await service.post('/api/v1/deploy/status', { // id: frontmatter.id, // 假设 frontmatter.id 是你需要的标识符 // }, { // headers: { // // 'Authorization': token // 如果需要身份验证,可以在这里加上 token // } // }).then((result: any) => { // console.log("==================>result:", result); // if (result && result.header.code !== 1006) { // statusText = result.header.message || '操作失败(后端返回错误)'; // return; // 如果返回失败,不继续处理 // } // if (result.header.code !== 1006){ // // 如果请求成功 // statusText = ""; // // 设置部署状态数据 // progress = '0%'; // 假设返回的数据里有进度 // } // else{ // // 如果请求成功 // statusText = result.header.message || '操作成功'; // // 设置部署状态数据 // progress = result.data.progress || '0%'; // 假设返回的数据里有进度 // } // }).catch((err) => { // console.error('请求部署状态失败:', err); // statusText = '请求失败'; // }); // } catch (err) { // console.error('请求部署状态错误:', err); // statusText = '请求失败'; // } return ( <> {/* */}
{/*
Blog

>

{frontmatter.title}

{ frontmatter.tags && frontmatter.tags?.length > 0 && frontmatter.tags?.map((item, index) => { return

{item}

}) }

{frontmatter.title}

*/}
{frontmatter.title}
); }; export default BlogArticleWrapper;