feat: 全面优化 SEO 元数据、结构化数据和站点地图
为所有工具页面添加 canonical URL、keywords、SoftwareApplication 和 BreadcrumbList 结构化数据,优化标题和描述以包含搜索意图关键词, 更新站点地图日期和优先级,移除无效的 SearchAction,新增 PWA manifest。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { Metadata } from "next";
|
||||
import { headers } from "next/headers";
|
||||
import { SoftwareApplicationStructuredData, BreadcrumbStructuredData } from "@/components/seo/StructuredData";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const headersList = await headers();
|
||||
@@ -7,25 +8,61 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
const lang = acceptLanguage.includes("zh") ? "zh" : "en";
|
||||
|
||||
const titles = {
|
||||
en: "Image Compression - Optimize Images for Web & Mobile",
|
||||
zh: "图片压缩 - 为网页和移动端优化图片",
|
||||
en: "Image Compression - Optimize PNG, JPEG, WebP Online Free",
|
||||
zh: "图片压缩 - 免费在线优化 PNG、JPEG、WebP 图片",
|
||||
};
|
||||
|
||||
const descriptions = {
|
||||
en: "Optimize images for web and mobile without quality loss. Support for batch processing and format conversion including PNG, JPEG, WebP.",
|
||||
zh: "为网页和移动端优化图片,不影响质量。支持批量处理和格式转换,包括 PNG、JPEG、WebP。",
|
||||
en: "Free online image compressor. Optimize PNG, JPEG, WebP, AVIF images without quality loss. Batch processing, format conversion, browser-based with no uploads required.",
|
||||
zh: "免费在线图片压缩工具。无损优化 PNG、JPEG、WebP、AVIF 图片。支持批量处理、格式转换,浏览器本地处理无需上传。",
|
||||
};
|
||||
|
||||
const keywords = {
|
||||
en: [
|
||||
"image compression",
|
||||
"image compressor online",
|
||||
"compress PNG",
|
||||
"compress JPEG",
|
||||
"WebP converter",
|
||||
"image optimizer",
|
||||
"batch image compression",
|
||||
"reduce image size",
|
||||
"AVIF converter",
|
||||
"browser-based",
|
||||
],
|
||||
zh: [
|
||||
"图片压缩",
|
||||
"在线图片压缩",
|
||||
"PNG压缩",
|
||||
"JPEG压缩",
|
||||
"WebP转换",
|
||||
"图片优化",
|
||||
"批量压缩",
|
||||
"缩小图片",
|
||||
"AVIF转换",
|
||||
"浏览器端",
|
||||
],
|
||||
};
|
||||
|
||||
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://kymr.top";
|
||||
|
||||
return {
|
||||
title: titles[lang],
|
||||
description: descriptions[lang],
|
||||
keywords: keywords[lang],
|
||||
alternates: {
|
||||
canonical: `${baseUrl}/tools/image-compress`,
|
||||
},
|
||||
openGraph: {
|
||||
title: titles[lang],
|
||||
description: descriptions[lang],
|
||||
url: `${baseUrl}/tools/image-compress`,
|
||||
type: "website",
|
||||
},
|
||||
twitter: {
|
||||
title: titles[lang],
|
||||
description: descriptions[lang],
|
||||
card: "summary_large_image",
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -35,5 +72,23 @@ export default function ImageCompressLayout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return children;
|
||||
return (
|
||||
<>
|
||||
<SoftwareApplicationStructuredData
|
||||
name="Image Compressor - KYMR.TOP"
|
||||
description="Free online image compression tool. Optimize PNG, JPEG, WebP, AVIF images without quality loss. Browser-based processing with no uploads."
|
||||
url="/tools/image-compress"
|
||||
category="MultimediaApplication"
|
||||
operatingSystem="Any (Browser-based)"
|
||||
/>
|
||||
<BreadcrumbStructuredData
|
||||
items={[
|
||||
{ name: "Home", url: "/" },
|
||||
{ name: "Tools", url: "/tools" },
|
||||
{ name: "Image Compression", url: "/tools/image-compress" },
|
||||
]}
|
||||
/>
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user