feat: 添加 PWA 支持和 SEO 优化
添加 PWA manifest 文件、favicon、结构化数据、sitemap 和 robots.txt。 优化根布局和组件的国际化支持,包括服务端语言检测和防止水合闪烁。
This commit is contained in:
67
src/app/(dashboard)/tools/texture-atlas/layout.tsx
Normal file
67
src/app/(dashboard)/tools/texture-atlas/layout.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
import type { Metadata } from "next";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const headersList = await headers();
|
||||
const acceptLanguage = headersList.get("accept-language") || "";
|
||||
const lang = acceptLanguage.includes("zh") ? "zh" : "en";
|
||||
|
||||
const titles = {
|
||||
en: "Texture Atlas Generator - Create Sprite Sheets Online",
|
||||
zh: "纹理图集生成器 - 在线创建精灵图",
|
||||
};
|
||||
|
||||
const descriptions = {
|
||||
en: "Generate texture atlases and sprite sheets for game development. Pack multiple sprites into a single texture atlas with JSON data export. All processing happens locally in your browser.",
|
||||
zh: "为游戏开发生成纹理图集和精灵图。将多个精灵打包到单个纹理图集中,支持导出 JSON 数据。所有处理都在您的浏览器本地进行。",
|
||||
};
|
||||
|
||||
const keywords = {
|
||||
en: [
|
||||
"texture atlas",
|
||||
"sprite sheet",
|
||||
"game development",
|
||||
"sprite packer",
|
||||
"texture packing",
|
||||
"game assets",
|
||||
"sprite generator",
|
||||
"JSON export",
|
||||
"browser-based",
|
||||
],
|
||||
zh: [
|
||||
"纹理图集",
|
||||
"精灵图",
|
||||
"游戏开发",
|
||||
"精灵打包",
|
||||
"纹理打包",
|
||||
"游戏资产",
|
||||
"精灵生成器",
|
||||
"JSON导出",
|
||||
"浏览器端",
|
||||
],
|
||||
};
|
||||
|
||||
return {
|
||||
title: titles[lang],
|
||||
description: descriptions[lang],
|
||||
keywords: keywords[lang],
|
||||
openGraph: {
|
||||
title: titles[lang],
|
||||
description: descriptions[lang],
|
||||
type: "website",
|
||||
},
|
||||
twitter: {
|
||||
title: titles[lang],
|
||||
description: descriptions[lang],
|
||||
card: "summary_large_image",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function TextureAtlasLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return children;
|
||||
}
|
||||
Reference in New Issue
Block a user