From 7744a6b420e3ee759e25e9a9c2deceec060b3515 Mon Sep 17 00:00:00 2001 From: chenchun Date: Wed, 2 Sep 2026 18:48:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20SEO=20=E5=95=86=E7=94=A8=E5=8C=96=20?= =?UTF-8?q?=E2=80=94=20robots/sitemap/OG/=E7=BB=93=E6=9E=84=E5=8C=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=20+=20=E6=9C=8D=E5=8A=A1=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - robots.txt:禁 /virtheart /api /unlock,含 sitemap 指向 - sitemap.xml:动态生成(首页 + 服务页 + 已发布作品详情) - metadata:metadataBase/title template/keywords/canonical/OG/Twitter 卡片/apple-icon,全部后台可改(site_title/description/keywords) - search_verification 字段:百度站长验证 meta(后台填入即生效) - JSON-LD:首页 Person 实体 + 服务页 ProfessionalService/ Offer - og.png(1200×630)与 icon/apple-icon 品牌图(scripts/gen-brand-images.py) - 页脚 ICP 备案号位(icp_beian,后台填入即显示,链工信部) - 服务清单内置 7 项(Web/小程序、AI 应用、Flutter、Java/Go、 产品设计、全栈交付、技术咨询),价格一律面议,DB 种子幂等 SEO 部署侧待办:百度/搜狗/360/Bing 站长平台提交与验证(填 search_verification 或放验证文件)、NEXT_PUBLIC_SITE_URL 指向正式域名。 --- app/(site)/layout.tsx | 40 +++++- app/(site)/page.tsx | 5 +- app/(site)/services/page.tsx | 51 +++++++- app/(site)/work/[slug]/layout.tsx | 48 ++++++- app/apple-icon.png | Bin 0 -> 4793 bytes app/icon-512.png | Bin 0 -> 2037 bytes app/icon.png | Bin 0 -> 4895 bytes app/robots.ts | 19 +++ app/sitemap.ts | 26 ++++ app/virtheart/(protected)/settings/page.tsx | 7 +- components/dom/FooterSection.tsx | 17 +++ components/dom/PersonJsonLd.tsx | 38 ++++++ lib/db.ts | 24 ++++ lib/siteConfig.ts | 12 +- lib/siteUrl.ts | 13 ++ public/icon.png | Bin 0 -> 4895 bytes public/og.png | Bin 0 -> 4313 bytes scripts/gen-brand-images.py | 138 ++++++++++++++++++++ 18 files changed, 419 insertions(+), 19 deletions(-) create mode 100644 app/apple-icon.png create mode 100644 app/icon-512.png create mode 100644 app/icon.png create mode 100644 app/robots.ts create mode 100644 app/sitemap.ts create mode 100644 components/dom/PersonJsonLd.tsx create mode 100644 lib/siteUrl.ts create mode 100644 public/icon.png create mode 100644 public/og.png create mode 100644 scripts/gen-brand-images.py diff --git a/app/(site)/layout.tsx b/app/(site)/layout.tsx index bb95ef8..216bb33 100644 --- a/app/(site)/layout.tsx +++ b/app/(site)/layout.tsx @@ -9,6 +9,7 @@ import { FullscreenTransitionProvider } from "@/lib/routeTransition"; import RouteTransitionOverlay from "@/components/dom/RouteTransitionOverlay"; import { getPasscodeAccessServer } from "@/lib/passcodeServer"; import { getSiteConfig } from "@/lib/siteConfig"; +import { SITE_URL } from "@/lib/siteUrl"; import type { Metadata } from "next"; /** @@ -19,9 +20,44 @@ import type { Metadata } from "next"; */ export async function generateMetadata(): Promise { const config = getSiteConfig(); + const title = config.site_title; + const description = config.site_description; return { - title: config.site_title, - description: config.site_description, + metadataBase: new URL(SITE_URL), + title: { + default: title, + template: `%s · ${config.brand_name || "北极新一"}`, + }, + description, + keywords: config.seo_keywords + ? config.seo_keywords.split(/[,,]/).map((k) => k.trim()).filter(Boolean) + : undefined, + verification: config.search_verification + ? { other: { "baidu-site-verification": config.search_verification } } + : undefined, + alternates: { canonical: "/" }, + icons: { + icon: [ + { url: "/icon.png", sizes: "192x192", type: "image/png" }, + { url: "/favicon.ico", sizes: "any" }, + ], + apple: "/apple-icon.png", + }, + openGraph: { + type: "website", + siteName: config.brand_name || "北极新一", + title, + description, + url: SITE_URL, + locale: "zh_CN", + images: [{ url: "/og.png", width: 1200, height: 630, alt: title }], + }, + twitter: { + card: "summary_large_image", + title, + description, + images: ["/og.png"], + }, }; } diff --git a/app/(site)/page.tsx b/app/(site)/page.tsx index fae7f5a..6ea21d7 100644 --- a/app/(site)/page.tsx +++ b/app/(site)/page.tsx @@ -4,6 +4,7 @@ import FooterSection from "@/components/dom/FooterSection"; import WorkSection from "@/components/dom/WorkSection"; import HyperSpaceSection from "@/components/dom/HyperSpaceSection"; import PasscodeRevealText from "@/components/dom/PasscodeRevealText"; +import { PersonJsonLd } from "@/components/dom/PersonJsonLd"; import { getSiteConfig, listWorks } from "@/lib/siteConfig"; import type { WorkItem } from "@/lib/workItems"; @@ -32,6 +33,8 @@ export default async function Home() { // Lenis is window-level, so main must NOT be a scroll container — // otherwise sticky (hyper-space section) never pins.
+ {/* 结构化数据:个人实体(SEO 富结果) */} +
{/* Banner Section */}
{/* Contact / Footer Section (#contact, data-section="footer") */} - +
); diff --git a/app/(site)/services/page.tsx b/app/(site)/services/page.tsx index afd204e..a0ddf9e 100644 --- a/app/(site)/services/page.tsx +++ b/app/(site)/services/page.tsx @@ -1,10 +1,19 @@ import type { Metadata } from "next"; import ServicesClient from "./ServicesClient"; import { getSiteConfig, listServices } from "@/lib/siteConfig"; +import { absoluteUrl } from "@/lib/siteUrl"; export const metadata: Metadata = { - title: "服务 · 北极新一", - description: "可提供的服务 — 选择你需要的服务,留言告诉我", + title: "服务", + description: + "Web / 小程序开发、AI 应用与 Agent 原型、Flutter 跨端客户端、Java/Go 后端、产品设计与全栈交付 — 选择你需要的服务,留言告诉我。", + alternates: { canonical: "/services" }, + openGraph: { + title: "服务 · 北极新一", + type: "website", + url: absoluteUrl("/services"), + images: ["/og.png"], + }, }; export const dynamic = "force-dynamic"; @@ -18,11 +27,39 @@ export default function ServicesPage() { description: s.description, priceNote: s.price_note, })); + + // 结构化数据:ProfessionalService(Google/Bing 富结果用) + const jsonLd = { + "@context": "https://schema.org", + "@type": "ProfessionalService", + name: `${config.brand_name} — 数字产品设计与开发`, + url: absoluteUrl("/services"), + email: config.contact_email, + areaServed: "CN", + availableLanguage: ["zh-CN"], + makesOffer: services.map((s) => ({ + "@type": "Offer", + name: s.title, + itemOffered: { + "@type": "Service", + name: s.title, + description: s.description, + }, + })), + }; + return ( - + <> +