2026年AI驱动:10分钟快速搭建个人网站全攻略(GitHub Pages + Vercel)
一、引言:现在搭个人网站,真的不用懂太多编程
放在两年前,我还觉得搭个人网站是开发者的专属技能,自己对着代码敲半天,还总出bug。但到了2026年,情况完全不一样了——借助AI编程助手,比如Claude code、Cursor、Qoder这些,就算你不是技术出身,也能快速生成可用的网站代码;再配合GitHub Pages和Vercel这两个免费平台,从头到尾10分钟,就能把网站部署上线,全程不用碰复杂的服务器配置。
我总结了一套简易的流程,下面分三大模块讲解:
-
GitHub Pages:部署单HTML文件,适合极简个人主页
-
Vercel:部署现代前端框架(Next.js/React/Vue),适合功能丰富的个人网站
-
AI辅助:用AI编程助手快速生成网站代码,降低开发门槛
二、方案一:GitHub Pages 部署单HTML文件(极简入门)
GitHub Pages 是GitHub提供的免费静态网站托管服务,完全免费、无需服务器、操作简单,我使用它最大的感受就是“省心、免费、不用折腾”。它适合做那种内容简单的静态页面,比如个人简历、简单的作品集展示,不用复杂的交互功能。 成品预览(你可以直接fork我这个项目):Luminary — 一个关于思考与写作的地方
2.1 核心优势与限制
| 优势 | 限制 |
|---|---|
| ✅ 永久免费,无广告 | ❌ 仅支持纯静态页面,无后端能力 |
| ✅ 与GitHub生态深度集成,版本管理便捷 | ❌ 国内访问稳定性一般,流量/存储有限(1GB存储/100GB流量/月) |
| ✅ 支持自定义域名,配置简单 | ❌ 无Serverless功能,复杂交互需前端实现 |
2.2 详细部署步骤(单HTML文件)
步骤1:准备工作
- 注册GitHub账号(Sign up for GitHub),完成邮箱验证
- 本地安装Git(Git),配置用户信息:
git config --global user.name "你的GitHub用户名"
git config --global user.email "你的GitHub注册邮箱"步骤2:创建GitHub仓库
-
登录GitHub,点击右上角「+」→「New repository」
-
仓库名称必须为:<你的用户名>.github.io(例如:
rice-awa.github.io),确保勾选「Public」(公共仓库) -
点击「Create repository」完成创建
步骤3:编写并上传HTML文件
- 克隆仓库到本地:
git clone https://github.com/<你的用户名>/<你的用户名>.github.io.git
cd <你的用户名>.github.io- 创建极简个人主页
index.html(可直接复制使用,或用AI生成优化):
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>我的个人主页</title>
<style>
body { font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 2rem; text-align: center; }
h1 { color: #2c3e50; }
.intro { color: #34495e; line-height: 1.6; margin: 2rem 0; }
</style>
</head>
<body>
<h1>欢迎来到我的2026个人主页</h1>
<div class="intro">
<p>AI驱动的快速建站实践 | 技术探索者 | 2026马年大吉</p>
<p>GitHub: <a href="https://github.com/<你的用户名>" target="_blank">点击访问</a></p>
</div>
</body>
</html>- 上传代码到GitHub:
git add .
git commit -m "Initial commit: 个人主页HTML"
git push origin main步骤4:开启GitHub Pages部署
-
进入仓库页面,点击顶部「Settings」→ 左侧「Pages」
-
「Source」选择「Deploy from a branch」,「Branch」选择「main」+「/ (root)」,点击「Save」
-
等待1-2分钟,访问 https://<你的用户名>.github.io 即可看到个人主页
2.3 进阶:使用gh-pages分支部署(多页面场景)
若需添加多个页面(如博客、项目展示),可创建gh-pages分支部署:
# 创建并切换到gh-pages分支
git checkout --orphan gh-pages
git rm -rf . # 清空当前分支文件
# 编写多页面代码后提交
git add .
git commit -m "Add multi-page content"
git push origin gh-pages
# 回到Settings → Pages,将Branch改为gh-pages三、方案二:Vercel 部署现代前端框架(功能进阶)
如果觉得GitHub Pages功能太简单,想做一个有交互、有多个页面的个人网站,比如个人博客、作品集展示站,那Vercel绝对是首选。我现在的个人博客就是用Vercel部署的,最大的感受是“零配置、速度快”,它是很多现代前端框架官方推荐部署平台的部署平台,支持零配置部署React、Vue、Svelte、Astro等主流框架,提供全球CDN加速、自动CI/CD、预览环境等高级功能。
3.1 核心优势与限制
| 优势 | 限制 |
|---|---|
| ✅ 零配置部署,自动识别框架并配置构建命令 | ❌ 免费版有额度限制(构建次数/月),超出需付费 |
| ✅ 全球70+边缘节点,访问速度快,支持SSR/SSG | ❌ 国内网络访问需特殊配置(可通过Cloudflare + 自定义域名解决) |
| ✅ 支持Serverless函数,可实现简单后端功能 | |
| ✅ 自动部署,提交代码即更新,支持预览环境 |
3.2 详细部署步骤(以Next.js为例)
步骤1:初始化现代前端项目(可AI生成)
-
安装Node.js 18+(https://nodejs.org/)
-
初始化Next.js项目(用AI助手可自动生成模板):
npx create-next-app@latest my-personal-site
cd my-personal-site- 本地运行测试:
npm run dev,访问http://localhost:3000 查看效果
步骤2:关联GitHub仓库
- 将项目推送到GitHub(先在GitHub创建空仓库
my-personal-site):
git init
git add .
git commit -m "Initial Next.js project"
git branch -M main
git remote add origin https://github.com/<你的用户名>/my-personal-site.git
git push -u origin main步骤3:Vercel部署全流程
-
注册Vercel账号(Verce),推荐用GitHub账号登录(自动授权)
-
登录后点击「New Project」→「Import Git Repository」,选择刚创建的
my-personal-site仓库 -
项目配置(自动识别Next.js框架,无需手动修改):
-
「Framework Preset」:自动选择「Next.js」
-
「Build Command」:自动填充
next build -
「Output Directory」:自动填充
.next -
「Project Name」:自定义(如
my-personal-site)
-
点击「Deploy」,等待1-3分钟部署完成
-
访问Vercel提供的默认域名(如
https://my-personal-site-<你的用户名>.vercel.app)即可看到网站
3.3 其他框架部署要点
-
React(Vite):初始化
npm create vite@latest my-react-site -- --template react,Vercel自动识别 -
Vue(Nuxt):初始化
npx nuxi init my-nuxt-site,Vercel支持零配置部署 -
纯HTML/CSS/JS:直接上传到GitHub,Vercel可导入仓库并部署
四、AI辅助:用编程助手快速生成与搭建网站
2026年,AI编程助手已成为建站核心工具,无需手写基础代码,通过对话即可生成符合需求的网站结构、样式与交互逻辑,大幅降低开发门槛。
4.1 主流AI编程助手选型(2026最新)
| 工具 | 特点 | 适用场景 |
|---|---|---|
| Cursor | 集成Claude 4.6 Sonnet,代码生成质量高,支持本地项目上下文 | 复杂个人网站、自定义交互 |
| Qoder | 阿里出品,中文支持优秀,免费额度充足,适配国内环境 | 国内用户、快速原型开发 |
4.2 实操:用Cursor生成个人网站代码
步骤1:准备提示词(Prompt)
打开Cursor,输入以下提示词(可根据需求修改),建议配合以下4.3 高效前端设计Skills(通用,来自Claude网页端) 使用:
你是一位资深前端开发工程师,帮我生成一个**极简个人主页**的完整代码,要求如下:
1. 技术栈:纯HTML + CSS + JS,无需框架,适配移动端
2. 页面结构:导航栏(首页、关于、项目、联系)、个人简介区、技能展示、页脚
3. 样式要求:2026马年主题,简约大气。
4. 交互:导航栏吸顶,技能卡片hover效果,平滑滚动
5. 内容:包含我的GitHub链接、AI编程助手使用心得
6. 输出:完整的index.html文件,包含所有CSS和JS,代码注释清晰
7. **遵循以下frontend-design skill(如果有)**步骤2:优化与调整
-
Cursor会生成完整代码,可直接复制到本地项目
-
若需修改,可继续对话调整:「把技能展示区改为卡片布局,添加马年图标」「修改导航栏为透明背景,滚动时变色」
-
用AI助手生成代码后,可直接上传到GitHub Pages或提交到Vercel项目仓库,一键部署
步骤3:AI+部署全流程加速
-
用Qoder生成个人网站代码 → 保存为
index.html -
用Git上传到GitHub Pages仓库 → 开启Pages部署
-
或直接导入Vercel → 自动部署,全程无需手动编写复杂代码
4.3 高效前端设计Skills(通用,来自Claude网页端)
---name: frontend-designdescription: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.---
`This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices.`
`The user provides frontend requirements: a component, page, application, or interface to build. They may include context about the purpose, audience, or technical constraints.`
`## Design Thinking`
`Before coding, understand the context and commit to a BOLD aesthetic direction:`
`- **Purpose**: What problem does this interface solve? Who uses it?`
`- **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction.`
`- **Constraints**: Technical requirements (framework, performance, accessibility).`
`- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?`
`**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work - the key is intentionality, not intensity.`
`Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is:`
`- Production-grade and functional`
`- Visually striking and memorable`
`- Cohesive with a clear aesthetic point-of-view`
`- Meticulously refined in every detail`
`## Frontend Aesthetics Guidelines`
`Focus on:`
`- **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font.`
`- **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.`
`- **Motion**: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise.`
`- **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.`
`- **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays.`
`NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character.`
`Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations.`
`**IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well.`
`Remember: You is capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision.`五、GitHub Pages vs Vercel 终极对比(2026版)
| 对比维度 | GitHub Pages | Vercel | 选择建议 |
|---|---|---|---|
| 成本 | 完全免费,无任何费用 | 免费版有额度限制,高级功能付费 | 纯静态页面选GitHub Pages;需高级功能选Vercel |
| 部署难度 | 简单,需手动配置分支/域名 | 零配置,自动识别框架,一键部署 | 新手选Vercel;追求极致免费选GitHub Pages |
| 性能 | 国内访问不稳定,CDN覆盖有限 | 全球70+边缘节点,访问速度快 | 面向全球用户选Vercel;国内用户可搭配Cloudflare |
| 功能支持 | 仅纯静态页面,无后端能力 | 支持SSR/SSG/Serverless,功能丰富 | 需后端/动态功能选Vercel;仅展示选GitHub Pages |
| 生态集成 | 与GitHub深度集成,版本管理强 | 与前端框架(Next.js/Vue/React)官方集成 | 框架项目选Vercel;纯HTML选GitHub Pages |
| 自定义域名 | 支持,免费SSL证书 | 支持,免费SSL证书,配置更灵活 | 两者均可,按需选择 |
六、总结与下一步
2026年搭建个人网站已进入**“AI生成+一键部署”的零门槛时代**:
-
若你追求极简、免费、稳定,选GitHub Pages,10分钟内完成单HTML页面部署
-
若你需要功能丰富、高性能、框架适配,选Vercel,零配置部署现代前端项目
-
若你是非技术人员,用AI编程助手也能快速生成代码,再配合部署平台,无需编程基础也能拥有专业个人网站
最后给大家一个下一步建议,搭完网站后可以做这几件事,让网站更专业:
-
用 AI 生成个性化网站内容(如个人简介、项目展示)。
-
绑定自定义域名,GitHub Pages和Vercel都支持,选一个好记的域名,显得更专业,免费SSL证书一定要配置,保证访问安全。
-
持续更新网站内容,比如定期添加项目、写点心得,也可以用AI工具优化网站体验,比如添加AI聊天助手、智能搜索功能。
文章分享
如果这篇文章对你有帮助,欢迎分享给更多人!