feat: 添加产品中心功能并优化博客系统

- 新增产品中心功能,包括产品列表页和详情页
- 实现产品多语言支持(中文、英文、越南语)
- 重构博客系统,从API获取改为本地MDX文件管理
- 更新favicon为PNG格式并修复相关引用
- 添加产品类型定义和获取逻辑
- 优化首页应用场景图片和链接
- 完善国际化配置和翻译
- 新增产品详情页标签切换组件
- 修复代理配置中的favicon路径问题
This commit is contained in:
砂糖
2025-12-10 11:32:50 +08:00
parent 1d23c01990
commit d8ec1d4384
35 changed files with 1264 additions and 511 deletions

View File

@@ -5,6 +5,7 @@ import { getPosts } from "@/lib/getBlogs";
import { constructMetadata } from "@/lib/metadata";
import { BlogPost } from "@/types/blog";
import fs from "fs/promises";
import matter from 'gray-matter';
import { Metadata } from "next";
import { MDXRemote } from "next-mdx-remote-client/rsc";
import { notFound } from "next/navigation";
@@ -31,7 +32,7 @@ async function getMDXContent(locale: string, section: string): Promise<BlogPost>
const content = await fs.readFile(filePath, "utf-8");
// 解析MDX文件的frontmatter和内容
const { frontmatter, content: postContent } = parseMDXContent(content);
const { data: frontmatter, content: postContent } = matter(content);
// 构建BlogPost对象
const blogPost: BlogPost = {
@@ -123,8 +124,6 @@ export async function generateMetadata({
const { locale, slug } = await params;
let post = await getMDXContent(locale, slug);
console.log(post, 'post');
if (!post) {
return constructMetadata({
title: "404",
@@ -151,7 +150,6 @@ export default async function BlogPage({ params }: { params: Params }) {
const { locale, slug } = await params;
let post = await getMDXContent(locale, slug);
console.log(post);
if (!post) {
return notFound();
}

View File

@@ -42,7 +42,7 @@ export default async function Page({
const resolvedSearchParams = await searchParams;
const category = resolvedSearchParams.category as string || "";
let { posts } = await getPosts(locale, category);
let { posts } = await getPosts(locale);
const t = await getTranslations("Blog");
@@ -77,12 +77,6 @@ export default async function Page({
<I18nLink href="/blog" prefetch={false} className="hover:underline">
</I18nLink>
{/* {typeLabel && (
<>
<span>/</span>
<span className="text-gray-700">{typeLabel}</span>
</>
)} */}
</div>
</div>