For AI agents: fetch the complete documentation index at /llms.txt, the full documentation corpus at /llms-full.txt, the agent skill at /skill.md, or this page as Markdown at /zh/docs/web/seo.md (or send Accept: text/markdown).
SEO 与分享
元数据、sitemap、robots 与社交图。
开始之前
使用“文件”→“打开文件夹”在 Visual Studio Code 中打开下载的 supastack 项目,然后选择“终端”→“新建终端”。存储库根目录是包含 package.json、apps 和 packages 的文件夹。运行下面的命令并保持终端打开。如果无法识别命令,请先完成工具安装指南,然后再继续。
首先阅读平台教程。服务器是响应浏览器或电话请求的应用程序进程。 Web 读取 apps/web/.env.local,Expo 读取 apps/mobile/.env.local,数据库迁移命令读取 root .env。无数据库/仪表板演示与真实/身份验证帐户分开,需要迁移Postgres。仅电话或桌面结帐需要单独运行的 Web 后端。
corepack pnpm --filter @supastack/web dev安装与配置
路由级元数据来自 Next.js metadata API —— 页面导出 metadata 对象或 generateMetadata,并从语言词典解析标题与描述,让搜索结果保持本地化。
sitemap.ts 与 robots.ts 生成可抓取界面;Open Graph 图与图标资源承载社交预览。把私有路由 —— settings、billing、admin、API —— 排除在 sitemap 之外并在 robots 中 disallow。
app/sitemap.ts public routes only
app/robots.ts disallow private surfaces
// per page
export const metadata = { title, description };实现流程
给每个公开页面唯一的标题与描述;绝不索引搜索结果、过滤视图或已认证界面。Canonical URL 保持无前缀 —— 语言层已把默认语言重定向到规范路径。
新增公开路由时在同一次改动里加入 sitemap。OG 图坚持用品牌令牌而非烘焙截图,让换风格保持一致。
验证与排障
在预览部署上拉取 /robots.txt 与 /sitemap.xml,校验 sitemap 可解析,并抽查一个页面的分享效果 —— 标题、描述、图。确认搜索结果页带 noindex。