后台设置和内容编辑改成可导航布局;部署用访客 origin 生成 Canonical,避免落到容器地址。 Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
408 B
TypeScript
16 lines
408 B
TypeScript
import type { MetadataRoute } from "next";
|
|
import { connection } from "next/server";
|
|
import { resolveSiteOrigin } from "@/lib/siteUrl";
|
|
|
|
export default async function robots(): Promise<MetadataRoute.Robots> {
|
|
await connection();
|
|
const origin = resolveSiteOrigin();
|
|
return {
|
|
rules: {
|
|
userAgent: "*",
|
|
allow: "/",
|
|
},
|
|
...(origin ? { sitemap: `${origin}/sitemap.xml` } : {}),
|
|
};
|
|
}
|