Next.jsReact启动器

seo-nextjs-starter — Next.js 启动器模板

作者 wangrunlin

一个基于 Next.js 的开源 SEO 启动模板,内置页面元数据、站点地图、社交分享图和结构化数据示例,可直接查看并改写。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

3 个预览视图
桌面端首页1 / 3
桌面端截图首屏预览

由服务器浏览器实际访问页面后截取。

全部页面与视图 3

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-10-03查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

通过统一的元数据辅助函数为每个页面生成标题、描述、canonical、Open Graph 与 Twitter 卡片

02

按路由生成 sitemap 与 robots,支持本地/预览 noindex 和显式生产 URL 配置

03

使用 next/og 动态生成 1200×630 PNG 社交图片及配套图标

04

提供 WebSite、SoftwareSourceCode、Article、BreadcrumbList 结构化数据示例,并对 JSON-LD 输出做转义

05

附带 journal 与产品页示例,以及中英双语文档、hreflang 和旧版 README 重定向

06

仓库包含 ESLint、TypeScript、Node 测试、生产构建和 HTTP SEO 断言等检查脚本

模板详细介绍

这是一个面向搜索引擎优化的 Next.js 启动器,仓库采用 MIT 许可,作者为 wangrunlin。它把常见的 SEO 基础能力集中到一套可运行的示例中:通过统一的元数据辅助函数为每个页面生成标题、描述、canonical、Open Graph 与 Twitter 卡片;按路由生成 sitemap 与 robots,并区分本地/预览环境的 noindex 与显式生产 URL;使用 next/og 生成 1200×630 的 PNG 社交图片和图标;提供 WebSite、SoftwareSourceCode、Article、BreadcrumbList 等结构化数据示例,输出时对 JSON-LD 做转义。

模板附带可检查的示例内容:一个包含静态文章与动态元数据的 journal,以及一个带发布清单的产品页;文档提供中英双语路由,并配置互指的 hreflang 与旧版 README 重定向。界面支持明暗主题、键盘导航和交互式 SEO 预览。仓库还包含 ESLint、TypeScript、Node 测试、生产构建以及针对实际 HTTP 响应的 SEO 断言等可重复执行的检查脚本。

使用时需要自行设置站点名称、标题、描述和生产域名等环境变量,并在增删页面时同步更新 sitemap。README 明确说明这是一套 SEO 基础能力,并不承诺排名或特定性能分数;首页预览仅为示意,搜索引擎可能改写标题与摘要。演示图片、字体、图标等第三方素材需按各自许可单独核对,域名、托管等外部服务可能另行收费。

Next.js启动器

适合你的项目吗?

适用场景

  • 为新站点搭建包含元数据、站点地图和社交分享图的 SEO 基础结构
  • 学习 Next.js 中页面级 metadata、动态 OG 图片和结构化数据的写法
  • 以示例 journal 和产品页为参照,改写为自己的内容与路由
  • 在部署前用仓库自带的 HTTP 检查脚本验证 canonical、sitemap、robots 和重定向等响应
  • 需要中英双语路由与 hreflang 配置的站点起步

适合人群

  • 使用 Next.js 并希望集中管理页面 SEO 元数据的开发者
  • 需要可运行、可检查的 SEO 示例而非纯文档说明的团队
  • 准备在 Vercel 上部署并自行配置生产域名的项目
  • 希望以 MIT 许可代码为基础进行修改和分发的使用者

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    需要 Node.js 22.x,并安装 pnpm 11.24.0,然后执行 pnpm install --frozen-lockfile

  2. 2

    复制 .env.example 为 .env.local,设置 NEXT_PUBLIC_SITE_NAME、NEXT_PUBLIC_TITLE、NEXT_PUBLIC_DESCRIPTION 和 NEXT_PUBLIC_URL

  3. 3

    NEXT_PUBLIC_URL 必须是纯 HTTP(S) 源,不含路径、查询或凭据;发布前配置真实生产域名

  4. 4

    增删页面时需同步更新 src/app/sitemap.ts,并按需修改 src/config.ts、示例内容和作者卡片

  5. 5

    部署后检查 /sitemap.xml、/robots.txt 和 /api/og,并确认渲染 HTML 中的 canonical 与社交标签

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • 运行示例无需账户、数据库或分析服务;但生产部署需自行配置域名与托管,可能产生外部服务费用。
  • Google Analytics 为可选,需自备 GA 测量 ID;不设置则禁用分析。
  • 发布前必须配置真实生产域名(NEXT_PUBLIC_URL),否则无法正确生成 canonical 与站点地图。
  • 增删页面时必须同步手动更新 sitemap.ts,否则站点地图与实际路由不一致。
  • 使用或分发时须按 MIT 许可保留版权与许可声明。
  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

No account, database, or analytics service is needed to run the examples.

README 原文

Optional: your own GA measurement ID; leave unset to disable analytics

README 原文

Configure your real production domain before publishing.

README 原文

When adding or removing pages, also update `src/app/sitemap.ts`.

README 原文

keep the copyright and license notice as required by the MIT license.

README 原文
https://github.com/wangrunlin/seo-nextjs-starter/blob/main/LICENSEhttps://github.com/wangrunlin/seo-nextjs-starter/blob/main/README.md

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-03。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料较完整 · 87 / 100
技术栈
Next.js · React
网站类型
启动器
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2026-09-11
截图检查日期
2026-10-03

已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。

目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。

查看当时使用的来源资料

SHA-256: c12ae2cf446d0ff8cbc9c06fa4d2aabca48da1af58d99beb7d7881219362d51d

2026-10-03T00:44:13.373Z

来源文件 / 仓库
# SEO Next.js Starter

[![中文](https://img.shields.io/badge/中文-Click_here-brightgreen?style=for-the-badge)](README-zh.md)
[![English](https://img.shields.io/badge/English-Click_here-brightgreen?style=for-the-badge)](README.md)

[![GitHub][GitHub]][GitHub URL]
[![GitHub stars][Stars]][Stars URL]
[![GitHub forks][Forks]][Forks URL]
[![GitHub issues][Issues]][Issues URL]
[![GitHub license][License]][License URL]
[![Last Commit][Last Commit]][Last Commit URL]

[![use this template][Use This Template]][Use This Template URL]

[![Deploy with Vercel][Deploy with Vercel]][Deploy with Vercel URL]

A head start for your next search result. An open-source Next.js starter with page metadata, sitemaps, social images, and practical examples you can inspect and adapt.

[Live demo](https://seo-nextjs.alin.run) · [Documentation](https://seo-nextjs.alin.run/docs) · [Examples](https://seo-nextjs.alin.run/examples) · [Vercel template](https://vercel.com/templates/next.js/seo-starter)

[![SEO Next.js Starter homepage](public/thumbnail.png)](https://seo-nextjs.alin.run)

## What ships with v1

- **Page-specific SEO:** titles, descriptions, canonical URLs, Open Graph, and Twitter cards through one metadata helper.
- **Production-aware indexing:** route-based sitemap, robots, local/Preview noindex, and an explicit production URL.
- **Dynamic social images:** 1200 × 630 PNG images generated with `next/og`, plus a matching icon.
- **Inspectable examples:** a journal with static articles and dynamic metadata, plus a product page with a working launch checklist.
- **Structured data:** WebSite, SoftwareSourceCode, Article, and BreadcrumbList examples with escaped JSON-LD output.
- **Bilingual documentation:** English and Chinese routes with reciprocal hreflang, working legacy README redirects, and readable code blocks.
- **Responsive design:** light/dark themes, keyboard navigation, interactive SEO previews, and author project cards.
- **Repeatable checks:** ESLint, TypeScript, Node tests, production build, and HTTP SEO assertions in GitHub Actions.

Built with **Next.js 16, React 19, TypeScript 5, Tailwind CSS 4, Node.js 22, and pnpm 11**. This is a set of SEO foundations, not a promise of rankings or a particular performance score.

## Quickstart

Create a repository with the **Use this template** button above, then clone your new repository:

```bash
# Node.js 22.x; install pnpm 11.24.0 if needed
npm install --global [email protected]
pnpm install --frozen-lockfile
cp .env.example .env.local
pnpm dev
```

Open [localhost:3000](http://localhost:3000). No account, database, or analytics service is needed to run the examples.

## Site configuration

Set these in `.env.local` for development and in your deployment environment for production:

```dotenv
NEXT_PUBLIC_SITE_NAME="Your site"
NEXT_PUBLIC_TITLE="Your page title"
NEXT_PUBLIC_DESCRIPTION="A useful description of your website."
NEXT_PUBLIC_URL="https://example.com"
# Optional: set false to opt out of indexing
# NEXT_PUBLIC_INDEXABLE="false"
# Optional: your own GA measurement ID; leave unset to disable analytics
# NEXT_PUBLIC_GOOGLE_ANALYTICS_ID="G-XXXXXXXXXX"
```

`NEXT_PUBLIC_URL` must be an HTTP(S) origin without a path, query, or credentials. Configure your real production domain before publishing. If omitted, Vercel deployments resolve their own project domain; local development falls back to `http://localhost:3000`. Preview deployments remain noindex even when the production URL is configured. Noindex pages allow crawling so robots can read that directive.

Add a page's metadata in its server component:

```tsx
import { pageMetadata } from "@/lib/seo";

export const metadata = pageMetadata(
  "About us",
  "/about",
  "Learn about the people and ideas behind our website.",
);
```

When adding or removing pages, also update `src/app/sitemap.ts`. Customize `src/config.ts`, the examples, and the author cards for your own project. The homepage preview is illustrative; search engines can rewrite titles and snippets.

## Deploy on Vercel

[![Deploy with Vercel][Deploy with Vercel]][Deploy with Vercel URL]

1. Create your own repository and Vercel project with the button.
2. Set `NEXT_PUBLIC_URL` to your production origin and customize your site name, title, and description. Add your custom domain in Vercel if using one.
3. Deploy, then inspect `/sitemap.xml`, `/robots.txt`, and `/api/og`. Check the rendered HTML for canonical and social tags.
4. After changing environment variables, redeploy. Keep Preview deployments noindex; do not copy the demo's domain or analytics ID into your project.

The maintained demo is [seo-nextjs.alin.run](https://seo-nextjs.alin.run); the existing [Vercel demo URL](https://seo-nextjs-starter.vercel.app) also remains available. The [marketplace listing](https://vercel.com/templates/next.js/seo-starter) is maintained separately from Git deployments.

## Check your changes

```bash
pnpm check        # lint, route types, TypeScript, tests, production build
pnpm start        # in a second terminal
pnpm test:seo     # checks actual HTTP responses at localhost:3000
# Optional: SEO_CHECK_URL=https://your-site.com pnpm test:seo
```

The HTTP checks cover example routes, canonical and sharing metadata, document language alternates, sitemap/robots, PNG assets, redirects, 404 responses, and the bundled author links. Adapt the route and author-link expectations when you customize the template. See [migration notes](MIGRATION.md) and the [changelog](CHANGELOG.md) when upgrading from 0.2.x.

## Project map

| Path                              | Purpose                              |
| --------------------------------- | ------------------------------------ |
| `src/config.ts`                   | Site identity and resolved URL       |
| `src/lib/seo.ts`                  | Page metadata and breadcrumb helpers |
| `src/app/sitemap.ts`, `robots.ts` | Discovery and indexing policy        |
| `src/app/api/og/route.tsx`        | Dynamic social PNG                   |
| `src/content/articles.ts`         | Journal example content              |
| `src/content/docs.*.md`           | Bilingual website documentation      |
| `tests/`, `scripts/check-seo.mjs` | Configuration and HTTP checks        |

## Projects from the Author

A few other tools and creative experiments by [Leo Wang](https://alin.run):

- [Toolbox Hub](https://toolbox-hub.com) — Free online tools.
- [H3Run](https://h3run.com) — AI video creation.
- [H3MaxLive](https://h3maxlive.com) — Interactive AI video.
- [Image 2.5](https://image-2-5.com) — AI image creation and editing.

These are author projects, not claims that they use this starter. You can remove or replace the showcase in your own site; keep the copyright and license notice as required by the MIT license.

## Share what you build

Have a project built with this template? [Submit your website](https://github.com/wangrunlin/seo-nextjs-starter/issues/new?template=submit-website.yml) or [report an issue](https://github.com/wangrunlin/seo-nextjs-starter/issues). Contributions are welcome; run the checks and keep changes focused. Commit messages follow this public repository's English Conventional Commits style.

## License

[MIT](LICENSE). Free to use, modify, and build on.

[Stars]: https://img.shields.io/github/stars/wangrunlin/seo-nextjs-starter?style=for-the-badge
[Stars URL]: https://github.com/wangrunlin/seo-nextjs-starter/stargazers
[Forks]: https://img.shields.io/github/forks/wangrunlin/seo-nextjs-starter?style=for-the-badge
[Forks URL]: https://github.com/wangrunlin/seo-nextjs-starter/forks
[Issues]: https://img.shields.io/github/issues/wangrunlin/seo-nextjs-starter?style=for-the-badge
[Issues URL]: https://github.com/wangrunlin/seo-nextjs-starter/issues
[License]: https://img.shields.io/github/license/wangrunlin/seo-nextjs-starter?style=for-the-badge
[License URL]: https://github.com/wangrunlin/seo-nextjs-starter/blob/main/LICENSE
[Last Commit]: https://img.shields.io/github/last-commit/wangrunlin/seo-nextjs-starter?style=for-the-badge
[Last Commit URL]: https://github.com/wangrunlin/seo-nextjs-starter/commits/main
[GitHub]: https://img.shields.io/badge/GitHub-wangrunlin%2Fseo--nextjs--starter-blue?style=for-the-badge&logo=github
[GitHub URL]: https://github.com/wangrunlin/seo-nextjs-starter
[Use This Template]: https://img.shields.io/badge/Use_this_template-Click_here-brightgreen?style=for-the-badge
[Use This Template URL]: https://github.com/new?template_name=seo-nextjs-starter&template_owner=wangrunlin
[Deploy with Vercel]: https://vercel.com/button
[Deploy with Vercel URL]: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwangrunlin%2Fseo-nextjs-starter&env=NEXT_PUBLIC_URL
[Preview URL]: https://seo-nextjs.alin.run/
[Vercel Environment Variables]: https://vercel.com/docs/projects/environment-variables
[Next.js Metadata Documentation]: https://nextjs.org/docs/app/api-reference/file-conventions/metadata
[Open Graph Image Generation Documentation]: https://vercel.com/docs/functions/og-image-generation
[Ahrefs SEO Guide]: https://ahrefs.com/seo
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。