fix(seo): 修复页面标题公司名重复与品牌名繁简体不一致问题

- 新增 COMPANY_INFO.displayName 属性用于页面标题和SEO元数据
- 统一所有页面 metadata 使用 displayName(简体"睿新致远")
- 视觉展示元素保留 shortName(繁体"睿新致遠"配合青柳隷書字体)
- 修复关于/联系/团队页面标题中公司名重复出现的问题
- 修复新闻ID从数字改为SEO友好slug
- 更新结构化数据使用完整公司名
- 修复ESLint报错:引号转义、组件displayName、any类型替换
This commit is contained in:
张翔
2026-05-03 09:15:14 +08:00
parent f0657ce9f4
commit 1bf22a8f95
29 changed files with 183 additions and 76 deletions
+31 -21
View File
@@ -2,40 +2,42 @@ import { describe, it, expect, jest } from '@jest/globals';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
type MotionProps = { children: React.ReactNode; className?: string; [key: string]: unknown };
jest.mock('framer-motion', () => ({
motion: {
div: ({ children, className, ...props }: any) => (
div: ({ children, className, ...props }: MotionProps) => (
<div className={className} {...props}>
{children}
</div>
),
section: ({ children, className, ...props }: any) => (
section: ({ children, className, ...props }: MotionProps) => (
<section className={className} {...props}>
{children}
</section>
),
span: ({ children, className, ...props }: any) => (
span: ({ children, className, ...props }: MotionProps) => (
<span className={className} {...props}>
{children}
</span>
),
h1: ({ children, className, ...props }: any) => (
h1: ({ children, className, ...props }: MotionProps) => (
<h1 className={className} {...props}>
{children}
</h1>
),
h2: ({ children, className, ...props }: any) => (
h2: ({ children, className, ...props }: MotionProps) => (
<h2 className={className} {...props}>
{children}
</h2>
),
},
AnimatePresence: ({ children }: any) => <>{children}</>,
AnimatePresence: ({ children }: { children: React.ReactNode }) => <>{children}</>,
useInView: () => [null, true],
}));
jest.mock('next/link', () => {
const MockLink = ({ children, href, ...props }: any) => (
const MockLink = ({ children, href, ...props }: { children: React.ReactNode; href: string; [key: string]: unknown }) => (
<a href={href} {...props}>
{children}
</a>
@@ -54,40 +56,48 @@ jest.mock('lucide-react', () => ({
Phone: () => <span data-testid="phone-icon" />,
}));
jest.mock('@/components/ui/card', () => ({
Card: ({ children, className, ...props }: any) => (
jest.mock('@/components/ui/card', () => {
const Card = ({ children, className, ...props }: { children: React.ReactNode; className?: string; [key: string]: unknown }) => (
<div className={className} {...props}>
{children}
</div>
),
CardContent: ({ children, className, ...props }: any) => (
);
const CardContent = ({ children, className, ...props }: { children: React.ReactNode; className?: string; [key: string]: unknown }) => (
<div className={className} {...props}>
{children}
</div>
),
}));
);
Card.displayName = 'Card';
CardContent.displayName = 'CardContent';
return { Card, CardContent };
});
jest.mock('@/components/ui/page-header', () => ({
PageHeader: ({ title, description }: any) => (
jest.mock('@/components/ui/page-header', () => {
const PageHeader = ({ title, description }: { title: string; description?: string }) => (
<header>
<h1>{title}</h1>
<p>{description}</p>
</header>
),
}));
);
PageHeader.displayName = 'PageHeader';
return { PageHeader };
});
jest.mock('@/components/ui/flip-clock', () => ({
FlipClock: ({ years, months, days }: any) => (
jest.mock('@/components/ui/flip-clock', () => {
const FlipClock = ({ years, months, days }: { years: number; months: number; days: number }) => (
<div data-testid="flip-clock">
{years}年 {months}月 {days}天
</div>
),
}));
);
FlipClock.displayName = 'FlipClock';
return { FlipClock };
});
jest.mock('@/lib/constants', () => ({
COMPANY_INFO: {
name: '四川睿新致远科技有限公司',
shortName: '睿新致遠',
displayName: '睿新致远',
description: '以智慧连接数字趋势,以伙伴身份陪您成长',
address: '四川省成都市龙泉驿区',
email: 'contact@ruixin.com',