关于 seo
面向网站开发者和营销人员的 SEO 优化技能,依据 Lighthouse 审计和 Google 搜索指南整理技术 SEO、页面优化与结构化数据实践。
主要功能
- 01抓取与索引配置
- 02标题、描述与页面结构优化
- 03结构化数据标记
- 04移动端与国际 SEO
- 05SEO 审计清单
适用场景
- 01检查网站的 SEO 技术问题
- 02优化页面标题和内容结构
- 03为页面添加结构化数据
- 04规划网站发布前的 SEO 检查
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ davila7/ claude-code-templates --skill seo安装后在 Claude Code 中输入/seo确认已加载。
详细介绍
SEO 优化
基于 Lighthouse SEO 审计和 Google 搜索指南的搜索引擎优化。重点关注技术 SEO、页面优化和结构化数据。
SEO 基础
搜索排名因素(大致影响):
| 因素 | 影响 | 本 Skill |
|---|---|---|
| 内容质量与相关性 | ~40% | 部分(结构) |
| 反向链接与权威性 | ~25% | ✗ |
| 技术 SEO | ~15% | ✓ |
| 页面体验(Core Web Vitals) | ~10% | 参见 Core Web Vitals |
| 页面 SEO | ~10% | ✓ |
技术 SEO
可抓取性
robots.txt:
# /robots.txt
User-agent: *
Allow: /
# Block admin/private areas
Disallow: /admin/
Disallow: /api/
Disallow: /private/
# Don't block resources needed for rendering
# ❌ Disallow: /static/
Sitemap: https://example.com/sitemap.xml
Meta robots:
<meta name="robots" content="index, follow">
<meta name="robots" content="noindex, nofollow">
<meta name="robots" content="index, nofollow">
<meta name="robots" content="max-snippet:150, max-image-preview:large">
规范 URL:
<link rel="canonical" href="https://example.com/page">
<link rel="canonical" href="https://example.com/current-page">
<link rel="canonical" href="https://example.com/products">
XML 站点地图
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2024-01-15</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/products</loc>
<lastmod>2024-01-14</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
站点地图最佳实践:
- 每个站点地图最多 50,000 个 URL 或 50MB
- 对于更大的网站使用站点地图索引
- 仅包含规范的、可索引的 URL
- 内容变更时更新
lastmod - 提交到 Google Search Console
URL 结构
✅ Good URLs:
https://example.com/products/blue-widget
https://example.com/blog/how-to-use-widgets
❌ Poor URLs:
https://example.com/p?id=12345
https://example.com/products/item/category/subcategory/blue-widget-2024-sale-discount
URL 指南:
- 使用连字符,而不是下划线
- 仅使用小写
- 保持简短(< 75 个字符)
- 自然地包含目标关键词
- 尽可能避免参数
- 始终使用 HTTPS
HTTPS 与安全
<img src="https://example.com/image.jpg">
<img src="http://example.com/image.jpg">
用于 SEO 信任信号的安全头:
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
页面 SEO
标题标签
<title>Page</title>
<title>Home</title>
<title>Blue Widgets for Sale | Premium Quality | Example Store</title>
标题标签指南:
- 50-60 个字符(Google 会截断约 60 个字符)
- 主要关键词靠近开头
- 每个页面唯一
- 品牌名称放在末尾(除非是首页)
- 适当时使用行动导向
Meta 描述
<meta name="description" content="">
<meta name="description" content="Shop premium blue widgets with free shipping. 30-day returns. Rated 4.9/5 by 10,000+ customers. Order today and save 20%.">
Meta 描述指南:
- 150-160 个字符
- 自然地包含主要关键词
- 有吸引力的行动号召
- 每个页面唯一
- 与页面内容匹配
标题结构
<h2>Welcome to Our Store</h2>
<h4>Products</h4>
<h1>Contact Us</h1>
<h1>Blue Widgets - Premium Quality</h1>
<h2>Product Features</h2>
<h3>Durability</h3>
<h3>Design</h3>
<h2>Customer Reviews</h2>
<h2>Pricing</h2>
标题指南:
- 每个页面一个
<h1>(主要主题) - 逻辑层次(不要跳过层级)
- 自然地包含关键词
- 具有描述性,而不是泛泛而谈
图片 SEO
<img src="IMG_12345.jpg">
<img src="blue-widget-product-photo.webp"
alt="Blue widget with chrome finish, side view showing control panel"
width="800"
height="600"
loading="lazy">
图片指南:
- 具有描述性且包含关键词的文件名
- Alt 文本描述图片内容
- 压缩并调整到适当尺寸
- 使用 WebP/AVIF 并提供回退
- 对首屏以下的图片进行懒加载
内部链接
<a href="/products">Click here</a>
<a href="/widgets">Read more</a>
<a href="/products/blue-widgets">Browse our blue widget collection</a>
<a href="/guides/widget-maintenance">Learn how to maintain your widgets</a>
链接指南:
- 包含关键词的描述性锚文本
- 链接到相关的内部页面
- 每个页面的链接数量合理
- 及时修复失效链接
- 使用面包屑导航体现层次
结构化数据(JSON-LD)
Organization
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Example Company",
"url": "https://example.com",
"logo": "https://example.com/logo.png",
"sameAs": [
"https://twitter.com/example",
"https://linkedin.com/company/example"
],
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-555-123-4567",
"contactType": "customer service"
}
}
</script>
Article
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to Choose the Right Widget",
"description": "Complete guide to selecting widgets for your needs.",
"image": "https://example.com/article-image.jpg",
"author": {
"@type": "Person",
"name": "Jane Smith",
"url": "https://example.com/authors/jane-smith"
},
"publisher": {
"@type": "Organization",
"name": "Example Blog",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.png"
}
},
"datePublished": "2024-01-15",
"dateModified": "2024-01-20"
}
</script>
Product
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Blue Widget Pro",
"image": "https://example.com/blue-widget.jpg",
"description": "Premium blue widget with advanced features.",
"brand": {
"@type": "Brand",
"name": "WidgetCo"
},
"offers": {
"@type": "Offer",
"price": "49.99",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"url": "https://example.com/products/blue-widget"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"reviewCount": "1250"
}
}
</script>
FAQ
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What colors are available?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Our widgets come in blue, red, and green."
}
},
{
"@type": "Question",
"name": "What is the warranty?",
"acceptedAnswer": {
"@type": "Answer",
"text": "All widgets include a 2-year warranty."
}
}
]
}
</script>
Breadcrumbs
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://example.com"
},
{
"@type": "ListItem",
"position": 2,
"name": "Products",
"item": "https://example.com/products"
},
{
"@type": "ListItem",
"position": 3,
"name": "Blue Widgets",
"item": "https://example.com/products/blue-widgets"
}
]
}
</script>
验证
在以下位置测试结构化数据:
移动端 SEO
响应式设计
<meta name="viewport" content="width=1024">
<meta name="viewport" content="width=device-width, initial-scale=1">
点击目标
/* ❌ Too small for mobile */
.small-link {
padding: 4px;
font-size: 12px;
}
/* ✅ Adequate tap target */
.mobile-friendly-link {
padding: 12px;
font-size: 16px;
min-height: 48px;
min-width: 48px;
}
字体大小
/* ❌ Too small on mobile */
body {
font-size: 10px;
}
/* ✅ Readable without zooming */
body {
font-size: 16px;
line-height: 1.5;
}
国际化 SEO
Hreflang 标签
<link rel="alternate" hreflang="en" href="https://example.com/page">
<link rel="alternate" hreflang="es" href="https://example.com/es/page">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page">
<link rel="alternate" hreflang="x-default" href="https://example.com/page">
语言声明
<html lang="en">
<html lang="es-MX">
SEO 审计清单
关键
- 已启用 HTTPS
- robots.txt 允许抓取
- 重要页面上没有
noindex - 标题标签存在且唯一
- 每个页面一个
<h1>
高优先级
- Meta 描述存在
- 已提交站点地图
- 已设置规范 URL
- 移动端响应式
- Core Web Vitals 通过
中优先级
- 已实现结构化数据
- 内部链接策略
- 图片 Alt 文本
- 具有描述性的 URL
- 面包屑导航
持续进行
- 修复 Search Console 中的抓取错误
- 内容变更时更新站点地图
- 监控排名变化
- 检查失效链接
- 查看 Search Console 洞察
工具
| 工具 | 用途 |
|---|---|
| Google Search Console | 监控索引、修复问题 |
| Google PageSpeed Insights | 性能 + Core Web Vitals |
| Rich Results Test | 验证结构化数据 |
| Lighthouse | 完整 SEO 审计 |
| Screaming Frog | 抓取分析 |
References
评论
支持 Markdown