feat(about): 添加关于页面的多个子页面内容

This commit is contained in:
2025-11-21 16:10:43 +08:00
parent bdc7ff6988
commit 64ad7a9cce
13 changed files with 260 additions and 31 deletions

View File

@@ -1,16 +1,15 @@
import { Locale, LOCALES, Link as I18nLink } from "@/i18n/routing";
import ParallaxHero from "@/app/[locale]/blog/ParallaxHero";
import TablerEyeFilled from "@/components/icons/eye";
import { Link as I18nLink, Locale, LOCALES } from "@/i18n/routing";
import { getPosts } from "@/lib/getBlogs";
import { constructMetadata } from "@/lib/metadata";
import dayjs from "dayjs";
import { Metadata } from "next";
import { getTranslations } from "next-intl/server";
import Image from "next/image";
import dayjs from "dayjs";
import TablerEyeFilled from "@/components/icons/eye";
import ParallaxHero from "@/app/[locale]/blog/ParallaxHero";
type Params = Promise<{ locale: string }>;
type SearchParams = { page?: string };
type SearchParams = { page?: string; type?: string };
type MetadataProps = {
params: Params;
@@ -40,10 +39,29 @@ export default async function Page({
searchParams?: SearchParams;
}) {
const { locale } = await params;
const { posts } = await getPosts(locale);
let { posts } = await getPosts(locale);
const t = await getTranslations("Blog");
// 分类筛选(公司新闻/专家访谈/行业动态/公告)
const type = (searchParams?.type || "").toLowerCase();
const typeLabelMap: Record<string, string> = {
company: "公司新闻",
experts: "专家访谈",
industry: "行业动态",
notice: "公告",
};
const typeLabel = typeLabelMap[type];
if (type) {
posts = posts.filter((p) => {
const metaType = String((p.metadata as any)?.type || "").toLowerCase();
const tags: string[] = (p.tags as any) || [];
const hitMeta = metaType === type;
const hitTag = Array.isArray(tags) && tags.some((t) => String(t).toLowerCase() === type);
return hitMeta || hitTag;
});
}
const pageRaw = searchParams?.page;
const page = Math.max(1, parseInt(pageRaw || "1", 10));
const pageSize = 10;
@@ -75,6 +93,12 @@ 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>